vb 绘制文字

来源:百度知道 编辑:UC知道 时间:2024/09/12 22:59:40
如何使用VB绘制文字?

建一个Command1,代码如下。
=========
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Declare Function DrawText Lib "user32" Alias "DrawTextA" (ByVal hdc As Long, ByVal lpStr As String, ByVal nCount As Long, lpRect As RECT, ByVal wFormat As Long) As Long
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Sub Command1_Click()
Dim DC As Long, r As RECT
r.Right = 1000
r.Bottom = 1000
DC = GetDC(0)
DrawText DC, "abcdefg", 7, r, 0
End Sub