开发者

Dock=>Fill a control in FlowLayoutPanel

开发者 https://www.devze.com 2022-12-28 00:46 出处:网络
I have a UserControl in which a FlowLayoutPanel (FlowDirection is as by default - LeftToRight). This user control consist of a description and some controls:

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:

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

  2. Use TableLayoutPanel instead. It does not have 'flow' characteristics, but it does support the 'fill' behavior you want.

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号