下面的代码可以实现圆形,不过还是最好使用image等控件实现更真实的效果。 有很多可以换肤窗体的例子,不妨查找一下。Option Explicit '----------------------------------------------------- '创建圆角API 声明 '----------------------------------------------------- Private Declare Function CreateRoundRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long, ByVal X3 As Long, ByVal Y3 As Long) As Long Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Long) As Long '----------------------------------------------------- '获得用户区大小 '----------------------------------------------------- Private Declare Function GetClientRect Lib "user32" (ByVal hWnd As Long, lpRect As RECT) As Long Private Type RECT Left As Long Top As Long Right As Long Bottom As Long End TypePrivate Sub Form_Load() Dim udtRect As RECT GetClientRect Command1.hWnd, udtRect
如果是按钮的话可以到capricciososoft.com起下载!他那个控件的确很好用,可以自己做皮肤!
有很多可以换肤窗体的例子,不妨查找一下。Option Explicit
'-----------------------------------------------------
'创建圆角API 声明
'-----------------------------------------------------
Private Declare Function CreateRoundRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long, ByVal X3 As Long, ByVal Y3 As Long) As Long
Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Long) As Long
'-----------------------------------------------------
'获得用户区大小
'-----------------------------------------------------
Private Declare Function GetClientRect Lib "user32" (ByVal hWnd As Long, lpRect As RECT) As Long
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End TypePrivate Sub Form_Load()
Dim udtRect As RECT
GetClientRect Command1.hWnd, udtRect
Dim lngRegion As Long
Dim lngReturn As Long
lngRegion = CreateRoundRectRgn(udtRect.Left, udtRect.Top, udtRect.Right, udtRect.Bottom, 20, 20)
lngReturn = SetWindowRgn(Command1.hWnd, lngRegion, True)End Sub