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?
OksplitContainer1.Panel1MinSize = ??? ;I mean what to write on the right side of the equation?Panel1 has a TableLayout which is docked to Fill
BDotA
2010-07-22 18:43:07
Hmm, ok, maybe I can set it to the width of the largest control inside the tableLayout panel?I will try it now
BDotA
2010-07-22 18:44:55
From the link provided:"An Int32 representing the minimum distance in pixels of the splitter from the left or top edge of Panel1."
RQDQ
2010-07-22 18:45:33
the example in the link is using hard coded values. is there a good idea how not to use hard coded values?
BDotA
2010-07-22 18:47:51
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
2010-07-22 18:51:58
a question for you Sir: on what EVENT of the splitterContainer? "Move" event is not firing
BDotA
2010-07-22 18:53:02
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
2010-07-22 18:58:06
@BDotA: no, set it in the form constructor. SplitterMoved is too late.
Hans Passant
2010-07-22 19:48:53