我想在点击按钮后,按钮变成椭圆形,这是一段VB的代码,请给看看,为什么不成功呢
Private Declare Function CreateRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function GetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long) As Long
Private Declare Function GetRgnBox Lib "gdi32" (ByVal hRgn As Long, lpRect As RECT) As Long
Private Declare Function CreateEllipticRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 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 Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Private Sub Command1_Click()
Dim WindowRect As RECT
Dim WindowRgn As Long
WindowRgn = CreateRectRgn(0, 0, 0, 0)
GetWindowRgn Command1.hWnd, WindowRgn
Debug.Print WindowRgn
GetRgnBox WindowRgn, WindowRect
Debug.Print WindowRect.Left
CreateEllipticRgn WindowRect.Left, WindowRect.Top, WindowRect.Right, WindowRect.Bottom
SetWindowRgn Command1.hWnd, WindowRgn, True
DeleteObject WindowRgn
End Sub