Http: // http://blog.csdn.net/wzuomin/archive/2007/08/24/1757635.aspx
1. Add Panel1 to form1 and set the dock to left.
2. Add button1, button2, button3, button4, and button5 in sequence in Panel1, and set the Dock of each button to top.
3. Add listbox1 to Panel1 and set the dock to fill.
4. Add the following parts to the Code Section:
Private sub btnclick () sub btnclick (byval sender as object, byval e as system. eventargs) handles button1.click, button2.click, button3.click, button4.click, button5.click
Dim clickbtn as button = ctype (sender, button)
Dim tabindex as integer = clickbtn. tabindex
If clickbtn. Dock = dockstyle. Top then
For each BTN as control in panel1.controls
If BTN. GetType. tostring. Equals ("system. Windows. Forms. Button") then
If BTN. tabindex> tabindex then BTN. Dock = dockstyle. Bottom
End if
Next
Else
For each BTN as control in panel1.controls
If BTN. GetType. tostring. Equals ("system. Windows. Forms. Button") then
If BTN. tabindex <= tabindex then BTN. Dock = dockstyle. Top
End if
Next
End if
Listbox1.items. Clear ()
For I as integer = 0 to tabindex
Listbox1.items. Add (string. Format ("control-{0}", I. tostring ))
Next
End sub