views:

18

answers:

1

Greeting, in C# WinForms: I have a splitterContainer. and lets sat there is Docked to Fill TableLayout in SplitterContainer.Panel1 now when I move the Splitter bar, it can cover the area of each of its panels. so it can even hide one of its panels when we move the splitter bar. But I do not want it! I want to have a limit for that. the minimum size I want to always be available for the panels of the SplitteRContainer is the size that is necessary for the contents that are already inside each panel of it. I do not want to be able to hide one panel and its contents by moving the splitter bar, so when it gets to that point I want it to stop moving and resizing the panels. Can you please help me on how to make this happen?

+3  A: 

Set the Panel1MinSize property.

SLaks
OksplitContainer1.Panel1MinSize = ??? ;I mean what to write on the right side of the equation?Panel1 has a TableLayout which is docked to Fill
BDotA
Hmm, ok, maybe I can set it to the width of the largest control inside the tableLayout panel?I will try it now
BDotA
From the link provided:"An Int32 representing the minimum distance in pixels of the splitter from the left or top edge of Panel1."
RQDQ
the example in the link is using hard coded values. is there a good idea how not to use hard coded values?
BDotA
I don't think there's any simple way to get the minimum size of your `TableLayoutPanel`. You could loop through all of the columns and add the sizes of the widest controls in each column.
SLaks
a question for you Sir: on what EVENT of the splitterContainer? "Move" event is not firing
BDotA
ok, thanks for the property name. I also found the correct event for it : private void splitContainer1_SplitterMoved(object sender, SplitterEventArgs e) { splitContainer1.Panel1MinSize = ctlDateRangeAccept.Width;
BDotA
@BDotA: no, set it in the form constructor. SplitterMoved is too late.
Hans Passant