添加一个timer控件 Interval属性为200 **********模块代码***************Option ExplicitPublic Declare Function GetCursorPos lib "user32" (lpPoint As POINTAPI) As LongPublic Declare Function GetwindowRect lib "user32" (ByVal hwnd As Long,lpRect As RECT) As LongPublic 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 LongPublic Type RECTleft As Longtop As LongRight As LongBottom As LongEnd TypePublic Type POINTAPIX As LongY As LongEnd TypePublic Const HWND_topMOST = -1Public Const SWP_NOSIZE = &H1Public Const SWP_NOMOVE = &H2Public Const HWND_top = 0Public Const SWP_NOACTIVATE = &H10Public Const SWP_SHOWWINDOW = &H40*********窗体程序代码**************Private Sub Form_Load()SetwindowPos Me.hwnd,HWND_topMOST,SWP_SHOWWINDOW Or SWP_NOMOVE Or SWP_NOSIZEEnd SubPrivate Sub Timer1_Timer()On Error Resume NextDim p As POINTAPIDim f As RECTGetCursorPos pGetwindowRect Me.hwnd,fIf Me.windowstate <> 1 ThenIf p.X > f.left And p.X < f.Right And p.Y > f.top And p.Y < f.Bottom ThenIf Me.top < 0 ThenMe.top = -10Me.ShowElseIf Me.left < 0 ThenMe.left = -10Me.ShowElseIf Me.left + Me.WIDth >= Screen.WIDth ThenMe.left = Screen.WIDth - Me.WIDth + 10Me.ShowEnd IfElseIf f.top <= 4 ThenMe.top = 40 - Me.HeightElseIf f.left <= 4 ThenMe.left = 40 - Me.WIDthElseIf Me.left + Me.WIDth >= Screen.WIDth - 4 ThenMe.left = Screen.WIDth - 40End IfEnd IfEnd Sub****************END*************************总结
以上是内存溢出为你收集整理的VB6 窗体边缘自动隐藏全部内容,希望文章能够帮你解决VB6 窗体边缘自动隐藏所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)