窗体放在屏幕最上面时,会自动隐进去,这种效果的实现方法
不知道那位大哥哥帮帮忙,提供一下一些代码
呵呵..像QQ那样对吧~!我一个程序里有这个..
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long 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
'窗口置顶以及自动隐藏窗体 Sub hideform1() '***************************************自动隐藏窗体 Dim p As POINTAPI Dim f As RECT GetCursorPos p '得到MOUSE位置 GetWindowRect Form1.hwnd, f '得到窗体的位置 If Form1.WindowState <> 1 Then If p.X > f.Left And p.X < f.Right And p.Y > f.Top And p.Y < f.Bottom Then 'MOUSE 在窗体上 If Form1.Top < 0 Then Form1.Top = -10 Form1.Show ElseIf Form1.Left < 0 Then Form1.Left = -10 Form1.Show ElseIf Form1.Left + Form1.Width >= Screen.Width Then Form1.Left = Screen.Width - Form1.Width + 10 Form1.Show End If Else If f.Top <= 4 Then Form1.Top = 40 - Form1.Height ElseIf f.Left <= 4 Then Form1.Left = 40 - Form1.Width ElseIf Form1.Left + Form1.Width >= Screen.Width - 4 Then Form1.Left = Screen.Width - 40 End If End If End If '******************************************** End Sub