Right-aligned labels in WinForms

后端 未结 9 1501
甜味超标
甜味超标 2021-01-07 15:59

The most obvious way to right-align a Label in WinForms doesn\'t work: setting anchor to Top/Bottom Right and TextAlign to TopRight. If the text changes the lab

9条回答
  •  -上瘾入骨i
    2021-01-07 16:52

    if you set the form property RightToLeft = yes; so you should not use the Text Align property just set the Anchor. try this approaches:

    Form.righttoleft = yes;
    label.anchor = Top, Right;
    label.TextAlign = TopLeft;
    

    or

    Form.righttoleft = No;
    label.anchor = Top, Right;
    label.TextAlign = TopRight;
    

    or

    Form.righttoleft = yes;
    label.righttoleft = No;
    label.anchor = Top, Right;
    label.TextAlign = TopRight;
    

提交回复
热议问题