像QQ一样自动隐藏的窗体
建一个timer控件.Interval 为200左右就可以了Private Sub Timer1_Timer()
Dim p As POINTAPI
Dim f As RECT
GetCursorPos p '得到MOUSE位置
GetWindowRect Me.hwnd, f '得到窗体的位置
If Me.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 Me.Top < 0 Then
Me.Top = -10
Me.Show
ElseIf Me.Left < 0 Then
Me.Left = -10
Me.Show
ElseIf Me.Left + Me.Width >= Screen.Width Then
Me.Left = Screen.Width - Me.Width + 10
Me.Show
End If
Else
If f.Top <= 4 Then
Me.Top = 80 - Me.Height
ElseIf f.Left <= 4 Then
Me.Left = 80 - Me.Width
ElseIf Me.Left + Me.Width >= Screen.Width - 4 Then
Me.Left = Screen.Width - 80
End If
End If
End If
End Sub 一点儿都看不懂!晕死 好,学习了 不太懂VB郁闷,记得几年前碰过VB时还是VB4吧,呵呵~~
逻辑部分还是明白的
[ 本帖最后由 qxtianlong 于 2006-1-3 15:03 编辑 ] 我先试试看 意思是用时钟定时获取窗口位置,如果窗口位置到指定位置就“+”或“—”窗体位置,直到窗体到一定位置,哈哈,不说了,连我都觉得我说不明白 学习一下~~~~~ 不会不会,大家都学E了
页:
[1]