Control Docking Rectangle inside of a Panel
I have a panel that renders a special header, this works all fine and good - but when I dock other controls inside of that panel, they size to fit underneath the header.
My thought was to try and catch this and control it somewhere. Getting the DisplayArea doesn't work - 开发者_如何转开发then the header doesn't draw in the right place. Is there any way I can tell docking to account for the height of the header?
Using C#, Windows Forms, .NET 3.5
Panel : System.Windows.Forms.UserControl Header : System.Windows.Forms.UserControl
Panel { Header { get; set; } }
is the basic structure. It's not terribly complicated.
Controls are docked in order of their z-order, back to front. When you add a control at run-time it is generally added in back, which means it will be docked before preexisting controls, allowing the new control to sneak under existing controls. It does not matter what order the controls were docked in.
Try calling SendToBack on the header control after adding other controls (or if this is a design time issue, just right-click it and do "Send To Back").
精彩评论