4

我正在使用flowLayoutPanel相对位置控制。我想更改flowLayoutPanel. 当我说位置时,我不是指 control2 之前的 control1 或类似的东西 - 我的意思是,如果我有 2 个控件,可以说label-comboBoxcomboBox高度是 21,label高度是 13,flowLayoutPanel高度也是 21 . 我想将- ((21-13)/2) 从顶部放在label垂直中间。flowLayoutPanel我不想要特定于垂直中间的东西我想要通用解决方案。

4

3 回答 3

4

您还可以将标签的上边距设置为 (containerHeight-labelHeight)/2

于 2011-02-17T23:17:53.943 回答
2

流布局不会有帮助:它只是将所有控件排列在一个列表中,调整它们的位置以适应面板。您可以通过将控件放在流布局内的表格中来创建子组,或者仅使用表格来实现最大控制。

于 2011-02-17T23:06:59.160 回答
0
    int cIndex = this.FlowLayoutPanel1.Controls.GetChildIndex(Button1);
    int bIndex = this.FlowLayoutPanel1.Controls.GetChildIndex(Button1);

    this.FlowLayoutPanel1.Controls.SetChildIndex(Button1, bIndex);
    this.FlowLayoutPanel1.Controls.SetChildIndex(Button2, cIndex);
于 2015-02-18T10:30:29.783 回答