XRLabel.Multiline 屬性 換行

XRLabel.Multiline Property

Gets or sets whether carriage return (CRLF) characters split the label's text into multiple lines.

NamespaceDevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v19.2.dll

#Declaration

[SRCategory(ReportStringId.CatBehavior)]
[DefaultValue(false)]
public bool Multiline { get; set; }

#Property Value

Type Default Description
Boolean

false

true, if carriage return (CRLF) characters split the label's text into multiple lines ; otherwise, false.

#Remarks

Set this property's value to true (process carriage returns) to display more than one line of text in an XRLabel control.

The following can be used as new line characters:

  • NewLine.
  • ControlChars.CrLf.
  • vbCrLf (Visual Basic only).

#Example

The code sample below illustrates how to display multiline text in an XRLabel control.

xrlabel-multiline

using DevExpress.XtraPrinting;
using DevExpress.XtraReports.UI;
// ...
public XRLabel CreateLabel() {
    // Create a new label object. 
    XRLabel label = new XRLabel();

    // Enable the multiline content.
    label.Multiline = true;
    label.Text = "This text illustrates \r\nhow to use the XRLabel.Multiline property \r\nto display multiline content \r\nin a label.";

    // Align the label's text to the middle.
    label.TextAlignment = TextAlignment.MiddleCenter;

    return label;
}

SEE ALSO

CanGrow

CanShrink

XRLabel Class

XRLabel Members

DevExpress.XtraReports.UI Namespace

Environment.NewLine 屬性

獲取爲此環境定義的換行字符串。

C#複製

public static string NewLine { get; }

屬性值

String

對於非 Unix 平臺爲包含“\r\n”的字符串,對於 Unix 平臺則爲包含“\n”的字符串。

示例

下面的示例顯示了由換行符分隔的三行。

C#複製

// Sample for the Environment.NewLine property
using System;

class Sample 
{
    public static void Main() 
    {
    Console.WriteLine();
    Console.WriteLine("NewLine: {0}  first line{0}  second line{0}  third line",
                          Environment.NewLine);
    }
}
/*
This example produces the following results:

NewLine:
  first line
  second line
  third line
*/

註解

NewLine 的屬性值是專門爲當前平臺和實現 .NET Framework 自定義的常量。 有關屬性值中轉義符的詳細信息,請參閱字符轉義

NewLine 提供的功能通常由字詞換行符、換行符、換行符、回車符、CRLF 和行尾所指。

NewLine 可以與特定於語言的換行符(如 Microsoft C#和 C/C++中的轉義符 "\r" 和 "\N",或 microsoft Visual Basic 中 vbCrLf)結合使用。

NewLine 將自動追加到 Console.WriteLine 和 StringBuilder.AppendLine 方法處理的文本上。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章