Check Align = Top Center上单选按钮的意外显示

时间:2012-01-06 11:32:31

标签: c# alignment flowlayoutpanel

我需要向RadioButton添加一些FlowLayoutPanel

如果我将单选按钮的属性保留为默认属性,则可以。但如果我设置CheckAlign = ContentAlignment.TopCenter,就会出错,就像这样

Wrong display on flow layout panel

这是我的代码:

for (int i = 0; i < 2; ++i) {
    RadioButton opt = new RadioButton() {
        Text = "Test",
        CheckAlign = ContentAlignment.TopCenter
    };

    pnlPassNumbers.Controls.Add(opt);
}

有人知道怎么回事? 谢谢!

1 个答案:

答案 0 :(得分:2)

您实际上没有描述错误的部分。也就是说,文本应该标记在标记的左侧还是标记的下方?

for (int i = 0; i < 2; ++i) {
    RadioButton opt = new RadioButton() {
        Text = "Test",
        CheckAlign = ContentAlignment.TopCenter,
        TextAlign = ContentAlignment.BottomCenter.
        Size = new Size(86, 36)
    };

    pnlPassNumbers.Controls.Add(opt);
}