3

I use Windows Forms SplitContainer. I want set the SplitterDistance value but for the Panel2 instead Panel1. Is it possible ?

When I set SplitterDistance, it sets the distance based on first panel, while I want to set the distance based on second panel.

Reza Aghaei
  • 120,393
  • 18
  • 203
  • 398
Julian50
  • 2,462
  • 1
  • 21
  • 30

1 Answers1

1

Set the distance based on width or height of control.

For example in a horizontal SplitterContainer when you want to set distance from bottom to 50, use such code:

splitContainer1.SplitterDistance = splitContainer1.Height - splitContainer1.SplitterWidth 
                                   - 50;

For a vertical SplitterContainer use width of control.

Reza Aghaei
  • 120,393
  • 18
  • 203
  • 398