输出无边界的空心字(代码)

来源:互联网 发布:怎么删除淘宝差评 编辑:程序博客网 时间:2024/05/09 14:53

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

原创粉丝点击