spitter problem
-
i hav a problem using the splitter.I hav tried to use it with panels and the splitting doesn't occur properly..For the form I added 3 panels. A base panel, a top panel and a bottom panel. i want to add a splitter between the top and bottom panels so that when u click and drag the panels should resize. How can I achieve this? samitha
-
i hav a problem using the splitter.I hav tried to use it with panels and the splitting doesn't occur properly..For the form I added 3 panels. A base panel, a top panel and a bottom panel. i want to add a splitter between the top and bottom panels so that when u click and drag the panels should resize. How can I achieve this? samitha
Using the designer, you have to add these in the right order. For example using a Windows Explorer-like layout, add a
Panel
and dock it to the left side. Add aSplitter
. Now add anotherPanel
and set theDock
property toDockStyle.Fill
(just "Fill" in the designer). If you look at the code, you'll notice that theTabStop
s are 0, 1, and 2 respectively. The order in which these controls are added (the most important part; theTabStop
in the designer determines this order but they don't have to match) is reversed:this.Controls.AddRange(new Control[] {
this.panel2,
this.splitter1,
this.panel1});Why they're reversed has to do with the way
AddRange
works internally. Replicate this in your code and you should be fine. If nothing else, try throwing together a new project and layout thePanel
s andSplitter
s in order the way you want them. Be sure to examine the code, however, to know what's being done by the designer.Microsoft MVP, Visual C# My Articles