Private Type LOGFONT
lfHeight As Long
lfWidth As Long
lfEscapement As Long
lfOrientation As Long
lfWeight As Long
lfItalic As Byte
lfUnderline As Byte
lfStrikeOut As Byte
lfCharSet As Byte
lfOutPrecision As Byte
lfClipPrecision As Byte
lfQuality As Byte
lfPitchAndFamily As Byte
lfFaceName(0 To LF_FACESIZE - 1) As Byte
End Type
Private Declare Function CreateFontIndirect Lib "gdi32" Alias "CreateFontIndirectA" (lpLogFont As LOGFONT) As Long
Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function SetBkMode Lib "gdi32" (ByVal hdc As Long, ByVal nBkMode As Long) As Long
Private Declare Function TextOut Lib "gdi32.dll" 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 Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (dest As Any, source As Any, ByVal numBytes As Long)
Private Const TRANSPARENT = 1
Private Sub Command1_Click()
Dim hwnd As Long
Dim LF As LOGFONT
Dim hFont As Long, oldfont As Long
hwnd = GetDC(0)
CopyMemory LF.lfFaceName(0), ByVal CStr("宋体"), LenB(StrConv("宋体", vbFromUnicode)) + 1
LF.lfHeight = (18 * 20) / Screen.TwipsPerPixelY
LF.lfWidth = (18 * 20) / Screen.TwipsPerPixelY
LF.lfCharSet = DEFAULT_CHARSET
hFont = CreateFontIndirect(LF)
oldfont = SelectObject(hwnd, hFont)
Cls
SetBkMode hwnd, TRANSPARENT '设置透明
TextOut hwnd, 550, 150, "ttyy", 18
TextOut hwnd, 600, 150, "staifdsj", 18
DoEvents
End Sub
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function SetBkMode Lib "gdi32" (ByVal hdc As Long, ByVal nBkMode As Long) As Long
Private Declare Function TextOut Lib "gdi32.dll" 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 Const TRANSPARENT = 1
Private Sub Timer1_Timer()
Dim hwnd As Long
hwnd = GetDC(0)
Cls
SetBkMode hwnd, TRANSPARENT '设置透明
TextOut hwnd, 550, 150, "ttyy", 18
TextOut hwnd, 600, 150, "staifdsj", 18
DoEvents
End Sub
代码里要加些什么???