在屏幕左上角画一个红色方块
Private Declare Function GetDC Lib "user32" (ByVal hwnd As IntPtr) As IntPtr
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim dh As IntPtr = GetDC(IntPtr.Zero)
Dim g As Graphics = Graphics.FromHdc(dh)
g.FillRectangle(New SolidBrush(Color.Red), 0, 0, 100, 100)
g.Dispose()
End Sub