4

I have a SplitContainer control on my form. It's docked to the form. And I set the SplitterDistance from code when the form loads.

This works fine except that the SplitterDistance changes when I resize the form. For example, when I make the form wider, the SplitterDistances seems to become larger so that it retains about the same percentage of width of the parent.

I don't want this. I want the distance between the splitter bar and the left of the control to stay the same as the window is resized. However, I don't want to set IsSplitterFixed = true because I still want to allow the user to change it.

Jonathan Wood
  • 65,341
  • 71
  • 269
  • 466

1 Answers1

10

You can set FixedPanel property to the panel which you want to remain the same size when the container is resized. You can do it using designer, or using code:

this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
Reza Aghaei
  • 120,393
  • 18
  • 203
  • 398