Display label text with line breaks in c#

后端 未结 8 677
面向向阳花
面向向阳花 2020-12-05 09:28

Is it possible to display the label text with line breaks exactly as per the image

\"enter

8条回答
  •  悲哀的现实
    2020-12-05 10:22

    You may append HTML
    in between your lines. Something like:

    MyLabel.Text = "SomeText asdfa asd fas df asdf" + "
    " + "Some more text";

    With StringBuilder you can try:

    StringBuilder sb = new StringBuilder();
    sb.AppendLine("Some text with line one");
    sb.AppendLine("Some mpre text with line two");
    MyLabel.Text = sb.ToString().Replace(Environment.NewLine, "
    ");

提交回复
热议问题