Dock=>Fill a control in FlowLayoutPanel
I have a UserControl in which a FlowLayoutPanel (FlowDirection is as by default - LeftToRight).
This user control consist of a description and some controls:
[descr.] 123456789
, it should be able to be reversed 987654321 [descr.]
So FlowLayoutPanel is used for this sc开发者_运维技巧ope(RightToLeft - True/False).
alt text http://lh5.ggpht.com/_1TPOP7DzY1E/S9B3MUrHo4I/AAAAAAAADLU/YiiSOPSQuso/s800/Capture1.png
Is this a way that the label1 fill the rest of the control(to left or right respectively)?
Unfortunately FlowLayoutPanel
doesn't support that kind of behavior.
There are three options I know of:
Manually make the label take up the rest of the space. (Recalculating when the
FlowLayoutPanel
changes size.) This is complex, especially if you add controls at runtime.Use
TableLayoutPanel
instead. It does not have 'flow' characteristics, but it does support the 'fill' behavior you want.Write your own control which does this. This could get complex.
I would probably go with the TableLayoutPanel
, but depending on your circumstances one of the other options may make more sense.
精彩评论