Label grow from right to left

前端 未结 6 578
逝去的感伤
逝去的感伤 2021-02-03 17:00

I have a label on my form which is on the right of the form. This label loads a dynamic text.

Sometimes the text that it loads is too long and the text crosses the borde

6条回答
  •  死守一世寂寞
    2021-02-03 17:40

    You can't make it "grow from right to left", but you can assign it's Left property so that it won't go out of the form:

    label1.Text = "some dynamic text here...";
    if (label1.Right > this.Width)
        label1.Left = this.Width - label1.Width;
    

    If the design allows it, you can also double its height so that the text will span two lines.

提交回复
热议问题