总在最前: Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long retValue = SetWindowPos(Me.hwnd, HWND_TOPMOST, Me.CurrentX, Me.CurrentY, 300, 300, SWP_SHOWWINDOW)创建不规则窗体: 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 Form_Load() Show 'The form! SetWindowRgn hWnd, CreateEllipticRgn(0, 0, 300, 300), True End Sub 'CreateEllipticRgn :建立椭圆矩形区域,参数分别为横向与纵向直径的起点和终点;
总在最前: Const HWND_TOPMOST = -1 Const HWND_NOTOPMOST = -2 Const SWP_NOSIZE = &H1 Const SWP_NOMOVE = &H2 Const SWP_NOACTIVATE = &H10 Const SWP_SHOWWINDOW = &H40 Private Declare Sub SetWindowPos Lib "User32" (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long)Private Sub Form_Activate() 'KPD-Team 1998 'URL: http://www.allapi.net/ 'E-Mail: [email protected] 'Set the window position to topmost SetWindowPos Me.hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE Or SWP_SHOWWINDOW Or SWP_NOMOVE Or SWP_NOSIZE End Sub 创建不规则窗体: borderstyle=0记住 Private Declare Function GetClipRgn Lib "gdi32" (ByVal hdc As Long, ByVal hRgn As Long) As Long Private Declare Function IntersectClipRect Lib "gdi32" (ByVal hdc As Long, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long Private Declare Function SelectClipRgn Lib "gdi32" (ByVal hdc As Long, ByVal hRgn As Long) As Long Private Declare Function OffsetClipRgn Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y 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 DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long Dim hRgn As Long Private Sub Form_Load() 'KPD-Team 2000 'URL: http://www.allapi.net/ 'E-Mail: [email protected] Me.ScaleMode = vbPixels End Sub Private Sub Form_Paint() Form_Resize End Sub Private Sub Form_Resize() Dim Ret As Long 'destroy the previous region DeleteObject hRgn 'create an elliptic region hRgn = CreateEllipticRgn(0, 0, Me.ScaleWidth, Me.ScaleHeight) 'select this elliptic region into the form's device context SelectClipRgn Me.hdc, hRgn 'move the clipping region OffsetClipRgn Me.hdc, 10, 10 'generate a new clipping region IntersectClipRect Me.hdc, 10, 10, 500, 300 'clear the form Me.Cls 'draw a Black rectangle over the entire form Me.Line (0, 0)-(Me.ScaleWidth, Me.ScaleHeight), vbBlack, BF 'create a temporary region Ret = CreateEllipticRgn(0, 0, 1, 1) 'copy the current clipping region into the temporary region GetClipRgn Me.hdc, Ret 'set the new window region SetWindowRgn Me.hWnd, Ret, True End Sub Private Sub Form_Unload(Cancel As Integer) 'clean up DeleteObject hRgn End Sub Private Sub Form_Click() 'unload the form when the user clicks on it Unload Me End Sub
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
retValue = SetWindowPos(Me.hwnd, HWND_TOPMOST, Me.CurrentX, Me.CurrentY, 300, 300, SWP_SHOWWINDOW)创建不规则窗体:
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 Form_Load()
Show 'The form!
SetWindowRgn hWnd, CreateEllipticRgn(0, 0, 300, 300), True
End Sub 'CreateEllipticRgn :建立椭圆矩形区域,参数分别为横向与纵向直径的起点和终点;
你感兴趣的话可以来信索取
E-mail:[email protected]
看看这个吧:http://www.csdn.net/expert/topic/459/459547.xml
总在最前:
Const HWND_TOPMOST = -1
Const HWND_NOTOPMOST = -2
Const SWP_NOSIZE = &H1
Const SWP_NOMOVE = &H2
Const SWP_NOACTIVATE = &H10
Const SWP_SHOWWINDOW = &H40
Private Declare Sub SetWindowPos Lib "User32" (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long)Private Sub Form_Activate()
'KPD-Team 1998
'URL: http://www.allapi.net/
'E-Mail: [email protected]
'Set the window position to topmost
SetWindowPos Me.hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE Or SWP_SHOWWINDOW Or SWP_NOMOVE Or SWP_NOSIZE
End Sub
创建不规则窗体:
borderstyle=0记住
Private Declare Function GetClipRgn Lib "gdi32" (ByVal hdc As Long, ByVal hRgn As Long) As Long
Private Declare Function IntersectClipRect Lib "gdi32" (ByVal hdc As Long, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function SelectClipRgn Lib "gdi32" (ByVal hdc As Long, ByVal hRgn As Long) As Long
Private Declare Function OffsetClipRgn Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y 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 DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
Dim hRgn As Long
Private Sub Form_Load()
'KPD-Team 2000
'URL: http://www.allapi.net/
'E-Mail: [email protected]
Me.ScaleMode = vbPixels
End Sub
Private Sub Form_Paint()
Form_Resize
End Sub
Private Sub Form_Resize()
Dim Ret As Long
'destroy the previous region
DeleteObject hRgn
'create an elliptic region
hRgn = CreateEllipticRgn(0, 0, Me.ScaleWidth, Me.ScaleHeight)
'select this elliptic region into the form's device context
SelectClipRgn Me.hdc, hRgn
'move the clipping region
OffsetClipRgn Me.hdc, 10, 10
'generate a new clipping region
IntersectClipRect Me.hdc, 10, 10, 500, 300
'clear the form
Me.Cls
'draw a Black rectangle over the entire form
Me.Line (0, 0)-(Me.ScaleWidth, Me.ScaleHeight), vbBlack, BF
'create a temporary region
Ret = CreateEllipticRgn(0, 0, 1, 1)
'copy the current clipping region into the temporary region
GetClipRgn Me.hdc, Ret
'set the new window region
SetWindowRgn Me.hWnd, Ret, True
End Sub
Private Sub Form_Unload(Cancel As Integer)
'clean up
DeleteObject hRgn
End Sub
Private Sub Form_Click()
'unload the form when the user clicks on it
Unload Me
End Sub