輸出無邊界的空心字(代碼)

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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章