TextBlock.MaxLines 屬性

定義

取得或設定 TextBlock中顯示的文字行數上限。

public:
 property int MaxLines { int get(); void set(int value); };
int MaxLines();

void MaxLines(int value);
public int MaxLines { get; set; }
var int32 = textBlock.maxLines;
textBlock.maxLines = int32;
Public Property MaxLines As Integer
<TextBlock MaxLines="int"/>

屬性值

Int32

int

TextBlock中顯示的文字行數上限。 預設值為 0,這是代表「自動」行為的特殊值。 值不能為負。

備註

使用 MaxLines 屬性可指定文字區塊中顯示的文字行數上限。 不論字型大小、字型樣式或文字長度為何,文字控制項都會調整其高度,以顯示不超過指定的行數。

負整數值無效,而且會導致執行時間例外狀況。

適用於