关于VB GDI

2025-03-07 11:23:55
推荐回答(1个)
回答1:

Option Explicit
Private Declare Function MoveToEx Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, lpPoint As Any) As Long
Private Declare Function LineTo Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long

Private Sub Command1_Click()
    Dim dc As Long
    dc = GetDC(Me.hwnd)
    MoveToEx dc, 10, 10, 0
    LineTo dc, 200, 10
End Sub

从(10,10)画一条线到(200,10)