我想在点击按钮后,按钮变成椭圆形,这是一段VB的代码,请给看看,为什么不成功呢

yannankai yannankai 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
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
...全文
评论 2
收藏 已收藏
分享
返回顶部
yannankai
VB基础类 7,788 成员 197,583 内容