[求助]圆形按钮消失了
Dim crgn As LongDim ret As Long
crgn = CreateEllipticRgn(5, 5, Command1.Width - 5, Command1.Height - 5)
ret = SetWindowRgn(Command1.hwnd, crgn, True)
这个怎么不行?设置圆形的区域跑哪里去了?
Option Explicit
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 Sub Command1_Click()
Dim hRgn As Long
hRgn = CreateEllipticRgn(0, 0, 100, 100)
SetWindowRgn Command1.hWnd, hRgn, True
End Sub
Private Sub Form_Load()
'Command1.Style = 1
'在属性窗口中设置Command1的Style为1
Command1.BackColor = vbRed '背景色为红色,这样做.是为了更清楚地显示看出Command1变成圆形
End Sub