比如试试这个,开个新窗体,粘贴Private Declare Function CombineRgn Lib "gdi32" (ByVal hDestRgn As Long, ByVal hSrcRgn1 As Long, ByVal hSrcRgn2 As Long, ByVal nCombineMode As Long) As Long 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 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 Const RGN_DIFF = 4Private Sub Form_Load() Dim rgn As Long Dim rgnRect As Long Dim rgnDest As Long rgn = CreateEllipticRgn(0, 0, Me.Width / Screen.TwipsPerPixelX, Me.Height / Screen.TwipsPerPixelY) rgnRect = CreateEllipticRgn((Me.Width / Screen.TwipsPerPixelX - 20) / 2, (Me.Height / Screen.TwipsPerPixelY - 20) / 2, (Me.Width / Screen.TwipsPerPixelX + 20) / 2, (Me.Height / Screen.TwipsPerPixelY + 20) / 2) rgnDest = CreateRectRgn(0, 0, 1, 1) CombineRgn rgnDest, rgn, rgnRect, RGN_DIFF
比如经常用SetWindowRgn, CreateEllipticRgn, CreateRectRgn, CombineRgn
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 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 Const RGN_DIFF = 4Private Sub Form_Load()
Dim rgn As Long
Dim rgnRect As Long
Dim rgnDest As Long
rgn = CreateEllipticRgn(0, 0, Me.Width / Screen.TwipsPerPixelX, Me.Height / Screen.TwipsPerPixelY)
rgnRect = CreateEllipticRgn((Me.Width / Screen.TwipsPerPixelX - 20) / 2, (Me.Height / Screen.TwipsPerPixelY - 20) / 2, (Me.Width / Screen.TwipsPerPixelX + 20) / 2, (Me.Height / Screen.TwipsPerPixelY + 20) / 2)
rgnDest = CreateRectRgn(0, 0, 1, 1)
CombineRgn rgnDest, rgn, rgnRect, RGN_DIFF
SetWindowRgn Me.hwnd, rgnDest, TrueEnd Sub
不过我要的不是这个效果,而我要的是窗体的 borderstyle 的值的改变。
比如在程序里将borderstyle 的值由设计时的2改为0的效果。
谢谢你了!!!
在VB6中,没法重载(不了解VB.Net),只能通过一些近乎疯狂歪道来实现,比如做N个Form
(这种效果我以前见过,WinGroove.估计不是VB做的)