开发者

WinForms : how to add toolStrip to a form already divided into left/right panes using a SplitContainer control

My form is divided up into left and right panes, and the right pane is split into upper and lower panes:

       AAAABBBB
       AAAACCCC  

There's a menu-strip at the top, below the title-bar and a status bar at the bottom:

       menuStrip
       AAAABBBB
       AAAACCCC
       status

Now I would like to add a开发者_如何学运维 toolStrip below the menuStrip. But when I do so, the toolStrip obscures the topmost content of the panes created using the splitContainer control. The Dock for the toolStrip = Top.

What am I doing wrong that the toolStrip doesn't simply get inserted between the menuStrip and the splitContainer control, pushing the splitContainer control down, so to speak?


You have to play with the BringToFront and SendToBack context menu items of those controls in the designer.


Drop the toolstrip container onto the form, then open the Document Outline window to re-arrange the controls into the correct hierarchy.


There are 2 simple ways of doing that:

Method 1

Open Document Outline window: View\Other windows\Document outline. Use buttons to place your control in the correct place

Method 2

Notice, that the current control in designer form is marked with some kind of focus rectangle. You can easily navigate through current control parents using Esc key: once pressed, it can be used to go exactly one parent up in hierarchy. Knowing the above just place your control in any place, cut it and then past it in the correct container. Repeat the step for any other control which is not in a good position When you need to change the order of control in the same container use Bring To Front and Bring To Back from context menu


You have to set the splitcontainer's dock to none and instead use its anchor settings

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜