Similar to the menu in the vs.net toolbox

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.