请问有谁知道,直接在电脑屏幕上绘画的功能是怎么实现的。
发布网友
发布时间:2022-04-24 12:09
我来回答
共1个回答
热心网友
时间:2023-10-12 08:28
下面的程序,可以在屏幕的指定位置画一个圆
Private Declare Function GetDC Lib "user32" ( _
ByVal hwnd As Long) As Long
Private Declare Function CreatePen Lib "gdi32" ( _
ByVal nPenStyle As Long, _
ByVal nWidth As Long, _
ByVal crColor As Long) As Long
Private Declare Function SelectObject Lib "gdi32" ( _
ByVal hdc As Long, _
ByVal hObject As Long) As Long
Private Declare Function Ellipse Lib "gdi32" ( _
ByVal hdc As Long, _
ByVal X1 As Long, _
ByVal Y1 As Long, _
ByVal X2 As Long, _
ByVal Y2 As Long) As Long
Private Declare Function ReleaseDC Lib "user32" ( _
ByVal hwnd As Long, _
ByVal hdc As Long) As Long
Private Declare Function DeleteObject Lib "gdi32" ( _
ByVal hObject As Long) As Long
Private Sub Form_Click()
Dim hdc As Long, hpen As Long
hdc = GetDC(0)
hpen = CreatePen(0, 1, zC)
SelectObject hdc, hpen
Ellipse hdc, 320 - 10, 240 - 10, 320 + 10, 240 + 10
DeleteObject hpen
ReleaseDC 0, hdc
End Sub