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.
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;