输出无边界的空心字(代码)
2004-09-11 09:50
316 查看
Private Declare Function BeginPath Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function EndPath Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function PathToRegion Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function TextOut Lib "gdi32" Alias "TextOutA" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal lpString As String, ByVal nCount As Long) As Long
Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Private Sub Form_Load()
Dim hRgn As Long
Me.WindowState = 2
Me.FontName = "Arial"
Me.FontSize = 100
Me.BackColor = vbRed
BeginPath Me.hdc
TextOut Me.hdc, 0, 0, "I love you !", 12
EndPath Me.hdc
hRgn = PathToRegion(Me.hdc)
SetWindowRgn Me.hWnd, hRgn, True
DeleteObject hRgn
End Sub
Private Declare Function EndPath Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function PathToRegion Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function TextOut Lib "gdi32" Alias "TextOutA" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal lpString As String, ByVal nCount As Long) As Long
Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Private Sub Form_Load()
Dim hRgn As Long
Me.WindowState = 2
Me.FontName = "Arial"
Me.FontSize = 100
Me.BackColor = vbRed
BeginPath Me.hdc
TextOut Me.hdc, 0, 0, "I love you !", 12
EndPath Me.hdc
hRgn = PathToRegion(Me.hdc)
SetWindowRgn Me.hWnd, hRgn, True
DeleteObject hRgn
End Sub
相关文章推荐
- 第一次动手写java的简单代码,实现输出一个空心菱形。
- 常用的一些小程序集合的算法描述和部分代码(输出BMP,截取yuv,边界标记)
- Java利用for循环输出空心菱形的实例代码
- Java输出空心菱形,代码超简洁
- 13,javase代码实战-循环控制——for循环输出空心的菱形(四)
- 这段代码输出什么?说明了什么问题?
- 关于textarea中原格式输出html代码
- <C语言>如何一步一步根据简单的代码联想到更多的功能?(实现输入一个整数,输出比它小包括它本身的所有素数。)
- 原题为 C++#面试每日一题#(16):运行下图中代码,输出的结果是什么?
- MySql数据库查询结果用表格输出PHP代码示例
- VC常用代码之输出调用出错信息
- 输出空心星号
- javascript实现的LI列表输出,隔行同色的代码
- Mysql的结果集输出Json java代码
- 立方体自动拼图软件(代码、注释、输出效果)
- C#新手入门代码 将一维string数组转换成二维char类型输出并输出
- HTML或JS代码原样输出的几种方法总结
- (1)把一个英语句子中的单词次序颠倒后输出。例如输入“how are you”,输出“you are how”; (2)编写单元测试进行测试; (3)用ElcEmma查看代码覆盖率,要求覆盖率达到100%。
- 挺激动的,琢磨了不久(目标1:给定一个源代码文件(.cs, .java),输出该文件的总行数、空行数、注释行数、代码行数)
- CodeSmith实用技巧(八):生成的代码输出到文件中