hello !
i am developing an desktop application , i want to make my menus just like in VS2008 have tool box , ,when we click on the main tab it will open and slid down , i want to make same thing , is there any one who guide me from where i can start this .
Sorry for my bad english :)
See if this helps. New.Project, 3.Buttons, 3.Panels(view attached image)
Public Class Form1
Private pnTemp As Panel, iSelPanel As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
pnTemp = Panel1 '// pnTemp, just easier to work w/. :)
If pnTemp.Height = 0 Then expandPanel(pnTemp) Else collapsePanel(pnTemp)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
pnTemp = Panel2
If pnTemp.Height = 0 Then expandPanel(pnTemp) Else collapsePanel(pnTemp)
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
pnTemp = Panel3
If pnTemp.Height = 0 Then expandPanel(pnTemp) Else collapsePanel(pnTemp)
End Sub
#Region "-----===-----===-----===-----===-----=== ===-----===-----===-----===-----===-----"
Private Sub collapsePanel(ByVal selPanel As Panel)
With selPanel.Name
iSelPanel = CInt(.Substring(.Length - 1)) '// get # at end of Panel.Name.
End With
For i As Integer = 0 To selPanel.Height '// loop from 0 to panel.height
selPanel.Height -= 1 '// ...and reduce height.
For Each ctl In New Control() {Button1, Panel1, Button2, Panel2, Button3, Panel3} '// loop thru all btns and panels.
If CInt(ctl.Name.Substring(ctl.Name.Length - 1)) > iSelPanel Then '// check if # at end of btn/panel is greater than the selectedPanel.
ctl.Top -= 1 '// move btn/panel up.
End If
Next
Next
End Sub
Private Sub expandPanel(ByVal selPanel As Panel, Optional ByVal iPanelHeight As Integer = 125)
With selPanel.Name
iSelPanel = CInt(.Substring(.Length - 1))
End With
For i As Integer = 0 To iPanelHeight
selPanel.Height += 1
For Each ctl In New Control() {Button1, Panel1, Button2, Panel2, Button3, Panel3}
If CInt(ctl.Name.Substring(ctl.Name.Length - 1)) > iSelPanel Then
ctl.Top += 1
End If
Next
Next
End Sub
#End Region
End Class
See if this helps.
New.Project, 3.Buttons, 3.Panels(view attached image)
Public Class Form1
Private pnTemp As Panel, iSelPanel As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
pnTemp = Panel1 '// pnTemp, just easier to work w/. :)
If pnTemp.Height = 0 Then expandPanel(pnTemp) Else collapsePanel(pnTemp)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
pnTemp = Panel2
If pnTemp.Height = 0 Then expandPanel(pnTemp) Else collapsePanel(pnTemp)
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
pnTemp = Panel3
If pnTemp.Height = 0 Then expandPanel(pnTemp) Else collapsePanel(pnTemp)
End Sub
#Region "-----===-----===-----===-----===-----=== ===-----===-----===-----===-----===-----"
Private Sub collapsePanel(ByVal selPanel As Panel)
With selPanel.Name
iSelPanel = CInt(.Substring(.Length - 1)) '// get # at end of Panel.Name.
End With
For i As Integer = 0 To selPanel.Height '// loop from 0 to panel.height
selPanel.Height -= 1 '// ...and reduce height.
For Each ctl In New Control() {Button1, Panel1, Button2, Panel2, Button3, Panel3} '// loop thru all btns and panels.
If CInt(ctl.Name.Substring(ctl.Name.Length - 1)) > iSelPanel Then '// check if # at end of btn/panel is greater than the selectedPanel.
ctl.Top -= 1 '// move btn/panel up.
End If
Next
Next
End Sub
Private Sub expandPanel(ByVal selPanel As Panel, Optional ByVal iPanelHeight As Integer = 125)
With selPanel.Name
iSelPanel = CInt(.Substring(.Length - 1))
End With
For i As Integer = 0 To iPanelHeight
selPanel.Height += 1
For Each ctl In New Control() {Button1, Panel1, Button2, Panel2, Button3, Panel3}
If CInt(ctl.Name.Substring(ctl.Name.Length - 1)) > iSelPanel Then
ctl.Top += 1
End If
Next
Next
End Sub
#End Region
End Class
this is what i needed , thankkkkkkkkkkkkk you soo much , great help for me :) thank again bro