开发者

Problems with FlowLayoutPanel inside Panel with AutoSize

开发者 https://www.devze.com 2022-12-26 21:40 出处:网络
I have the following controls hierarchy: Form Panel (AutoSize = true, AutoSizeMode = GrowAndShrink, Dock = Top)

I have the following controls hierarchy:

Form
  Panel (AutoSize = true, AutoSizeMode = GrowAndShrink, Dock = Top)
    FlowLayoutPanel (AutoSize = true, AutoSizeMode = GrowAndShrink, Dock = Top)
      Control1, Control2, Control3, Control4, ...
    FlowLayoutPanel (AutoSize = true, AutoSizeMode = GrowAndShrink, Dock = Top)
      Control1, Control2, Control3, Control4, ...

Here is how it layouts in various sizes:

Fully visible all 8 buttons, but the Panel forgot to shrink

Fully visible all 8 buttons, but the Panel forgot to shrink http://img534.imageshack.us/img534/3575/panels1.png

The first FlowLayoutPanel are fully visible, but the second is only half visible, button8 is missing

The first FlowLayoutPanel are fully visible, but the second is only half visible, button8 is missing http://img301.imageshack.us/img301/5296/panels2.png

The first FlowLayoutPanel are fully visible, but the second is only half visible, button7 and button8 are missing

The first FlowLayoutPanel are fully visible, but the second is only half visible, button7 and button8 are missing http://img697.imageshack.us/img697/4644/panels3.png

The first FlowLayoutPanel are开发者_StackOverflow fully visible, but the second is only quarter visible, button 6, button7 and button8 are missing

The first FlowLayoutPanel are fully visible, but the second is only quarter visible, button 6, button7 and button8 are missing http://img168.imageshack.us/img168/6428/panels4.png

As you see, i'm not satisfied from this behavior. Is there something i can do to get all this work?


It looks to me like a bug... you could report it to Microsoft.

One possible workaround: try to use tableLayoutPanel instead of your outer panel. Like this:

Form
    TableLayoutPanel (1 column, 2 rows with 50% size type)
        FlowLayoutPanel1 (AutoSize = true, in first row of the TableLayoutPanel, Dock = Fill)
            Button1, Button2, Button3, Button4, ...
        FlowLayoutPanel2 (SutoSize = true, in second row of the TableLayoutPanel, Dock = Fill)
            Button1, Button2, Button3, Button4, ...
0

精彩评论

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

关注公众号