开发者

setting anchor for "controls in a panel" inside a "flowlayoutpanel"

In my windows application

I have a normal panel inside a flowlayoutpanel

In this normal panel, i have some input controls(e.g. labels, textbox...)

I have set the anchor properties thinking that it will auto-resize when I resize the window.

But when i tested it, only the flowlayoutpanel auto-resize itself, as i can see that the sroll bar has moved further toward the开发者_开发百科 right... the contorls in the normal panel didnt move at all.

anyone know what is wrong here?

Thank You!


I have encountered the same problem. Apparently, the controls in the FlowLayoutPanel are sized according to the widest control in this panel. I've solved this by overriding the 'Resize' event on the FlowLayoutPanel and change one of the controls relative to the size of the FlowLayoutPanel:

private void RulesPanel_Resize(object sender, EventArgs e)
{
    FlowLayoutPanel panel = (FlowLayoutPanel)sender;
    button_in_panel.Width = panel.Width - 50;
}

Once one is set, the others are resized properly. This is also true for those that have Anchors specified.


In the following post Lenny answered the question already

cannnot-resize-child-controls-in-a-flowlayoutpanel-control

or this:

flowlayoutpanel-issues

So i think theres no way. For what exactley you need that control?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜