views:

385

answers:

1

I am dynamically added a bunch of buttons to a toolbar. I want the ability to programatically make it wrap onto a second row if the number of buttons exceeds the horizontal space in the current form. I dont want users to have to click the dropdown button to view more buttons as i need to ensure that all buttons are viewable always.

are there any suggestions for how to do this.

+1  A: 

You need just four lines. First, disable docking:

Me.ToolStrip1.Dock = System.Windows.Forms.DockStyle.None

Then turn off auto-sizing:

Me.ToolStrip1.AutoSize = False

Now set the layout to "Flow"

Me.ToolStrip1.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.Flow

Then then change the size to double the height of a normal ToolStrip, or whatever you want.

Me.ToolStrip1.Size = New System.Drawing.Size(300, 50)
amdfan