如何在屏幕上画圈
如何用vb在电脑屏幕中心画个小红圈。。是屏幕上不是窗体上。。
Option Explicit Private Type POINTAPI x As Long y As Long End Type Private Declare Function GetDesktopWindow Lib "user32" () As Long Private Declare Function GetWindowDC Lib "user32" (ByVal hwnd As Long) As Long Private Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hdc 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 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 DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long Private Const PS_SOLID = 0 Private Sub Command1_Click() Dim x As Long Dim y As Long Dim deskHwnd As Long Dim hDeskDC As Long Dim hPen As Long x = Screen.Width / Screen.TwipsPerPixelX / 2 y = Screen.Height / Screen.TwipsPerPixelY / 2 deskHwnd = GetDesktopWindow() hDeskDC = GetWindowDC(deskHwnd) If hDeskDC = 0 Then Exit Sub hPen = CreatePen(PS_SOLID, 2, vbRed) If hPen = 0 Then Exit Sub SelectObject hDeskDC, hPen Ellipse hDeskDC, x - 10, y - 10, x + 10, y + 10 DeleteObject hPen ReleaseDC deskHwnd, hDeskDC End Sub