Having more than one toolstrip at the same line
C# WinForms: I would like to have two Toolbars But I also want them to be at the same line . I mean I do Not want one of them to be below or over the other them. so they will be in tow lines which is I do not want.
How can I do this?开发者_如何学Go
Add a FlowLayoutPanel to your Form (AutoSize=True;AutoSizeMode=GrowAndShrink;Dock=Top;FlowDirection=LeftToRight;WrapContents=True). Then add the two ToolStrip controls to the FlowLayoutPanel (Dock=Top);
The ToolStrips may wrap, depending on the width of the Form.
I'm assuming you're using the visual studio designer..if not, let me know.
Put down a ToolStrip Container, change it's visibility to be (assuming you want it at the top of your app) top only, then click "Dock Fill in Form"
Now add drag two toolstrips onto the container. Presto :-)
Edit:
Per your requirements, it gets a bit tricky, but not so bad. Click on your toolstrip so it has the small white box in the upper left hand corner, and the small triangle in the upper right. Click the triangle and change Dock to "None" Now manually stretch it to fill half the screen/whatever and do the same for the second toolbar.
Only problem with this approach is that occasionally, i've noticed visual studio "repositioning" the toolbars a pixel or two randomly after a compile. So, double check before releasing to the customer :-D
精彩评论