Unexpected display for RadioButton on CheckAlign = TopCenter
-
14-04-2021 - |
質問
I need to add some RadioButton
s to a FlowLayoutPanel
.
If I leave radio buttons' properties as default, it will fine. But if I set CheckAlign = ContentAlignment.TopCenter
, it will go wrong, like this
Here's my code:
for (int i = 0; i < 2; ++i) {
RadioButton opt = new RadioButton() {
Text = "Test",
CheckAlign = ContentAlignment.TopCenter
};
pnlPassNumbers.Controls.Add(opt);
}
Anybody know how was it wrong? Thanks!
解決
You don't describe actually what is the wrong part. That is, should the text be aligned to the left of the mark, or below it?
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);
}
所属していません StackOverflow