FORM DOCKABLE
Ae pessoal!
Eu gostaria de um codigo que permitisse o form "grudar" nos lados da tela, assim como a barra de tarefas do win e se possivel que tenha aquele recurso de auto-ocultar!
Abraços
LEOx
Eu gostaria de um codigo que permitisse o form "grudar" nos lados da tela, assim como a barra de tarefas do win e se possivel que tenha aquele recurso de auto-ocultar!
Abraços
LEOx
Tente isso:
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Type POINTAPI
X As Long
Y As Long
End Type
'Declare the API-Functions
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
'Private Declare Function SetCursorPos Lib "user32" (ByVal X As Long, ByVal Y As Long) As Long
Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
Private Sub SetMe()
Me.Top = 0
Me.Left = 0
Me.Height = Picture1.Height
Me.Width = Screen.Width
Command1.Left = Picture2.ScaleWidth - Command1.Width
Command1.Top = 0
End Sub
Private Sub Command1_Click()
Unload Me
End Sub
Private Sub Form_Load()
Me.ScaleMode = 1
Picture1.Height = 30
Picture1.Align = 2
Picture1.BackColor = vbHighlight
Picture2.Align = 1
Picture2.Height = 615
Timer1.Interval = 1
Timer1.Enabled = False
SetMe
End Sub
Private Sub Form_Resize()
If Me.Height Picture2.Height + Picture1.Height Then Picture2.Visible = False Else Picture2.Visible = True
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Me.Height = Picture2.Height + Picture1.Height
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
Dim Rec As RECT, Point As POINTAPI
' Get Left, Right, Top and Bottom of ExplButton
GetWindowRect Me.hwnd, Rec
' Get the position of the cursor
GetCursorPos Point
' If the cursor isn't located above ExplButton then
If Point.X Rec.Left Or Point.X Rec.Right Or Point.Y Rec.Top Or Point.Y Rec.Bottom Then SetMe: Timer1.Enabled = False
End Sub
Tópico encerrado , respostas não são mais permitidas