Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'给Panel1设置初始位置
Me.Panel1.Width = Me.Label1.Width + 5
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
'当Panel1最大化时,如果将光标移出Panel1,则在1.5秒后自动关闭工具框
If Me.Panel1.Width = 128 Then
If MousePosition.X > Me.Left + Me.Panel1.Width Then
Button2_Click_1(sender, e)
End If
End If
End Sub
Private Sub Label1_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles Label1.MouseHover
While Me.Panel1.Width < 128
Me.Panel1.Width = Panel1.Width + 1
End While
Timer1.Enabled = True
End Sub
'Private Sub ToolBar2_ButtonClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs)
'Select Case ToolBar2.Buttons.IndexOf(e.Button)
'Case 1
' MessageBox.Show("hehe")
' End Select
' End Sub
'收缩回去
Private Sub Button2_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
'Button4_Click(sender, e)
While Me.Panel1.Width > Me.Label1.Width + 5
Me.Panel1.Width = Panel1.Width - 1
End While
Timer1.Enabled = False
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
'首先调用最下层的折叠事件
'Button4_Click(sender, e)
' Panel5.SuspendLayout()
While Pnlthree.Height > Button4.Height + 5
Pnlthree.Height = Pnlthree.Height - 1
End While
'调用下层的折叠事件,同时移动Y轴和缩短高度,保证其向下移动并不引起最下层的闪烁
While Pnltwo.Height > Button4.Height + 3
Pnltwo.Top = Pnltwo.Top + 1
Pnltwo.Height = Pnltwo.Height - 1
End While
'Panel5.ResumeLayout()
End Sub
'//控制展开的代码
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
While Pnlthree.Height > Button4.Height + 5
Pnlthree.Height = Pnlthree.Height - 1
End While
While Pnltwo.Top > Button3.Top + Button3.Height + 2
Pnltwo.Top = Pnltwo.Top - 1
Pnltwo.Height = Pnltwo.Height + 1
End While
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
While Pnltwo.Top > Button3.Top + Button3.Height + 2
Pnltwo.Top = Pnltwo.Top - 1
Pnltwo.Height = Pnltwo.Height + 1
End While
While Pnlthree.Top > Pnltwo.Top + Button6.Height + 5
Pnlthree.Height = Pnlthree.Height + 1
Pnlthree.Top = Pnlthree.Top - 1
End While
End Sub
'//////////////
'悬停工具栏
Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Timer1.Enabled = False
End Sub