DataGridViewCellStyle.WrapMode 屬性

定義

取得或設定值,指出當 DataGridView 儲存格中的文字內容太長而無法置於一行時,是否要將它換行或截斷它。Gets or sets a value indicating whether textual content in a DataGridView cell is wrapped to subsequent lines or truncated when it is too long to fit on a single line.

public:
 property System::Windows::Forms::DataGridViewTriState WrapMode { System::Windows::Forms::DataGridViewTriState get(); void set(System::Windows::Forms::DataGridViewTriState value); };
public System.Windows.Forms.DataGridViewTriState WrapMode { get; set; }
member this.WrapMode : System.Windows.Forms.DataGridViewTriState with get, set
Public Property WrapMode As DataGridViewTriState

屬性值

DataGridViewTriState

其中一個 DataGridViewTriState 值。One of the DataGridViewTriState values. 預設為 NotSetThe default is NotSet.

例外狀況

屬性值不是有效的 DataGridViewTriState 值。The property value is not a valid DataGridViewTriState value.

範例

下列程式碼範例說明如何使用此屬性。The following code example illustrates the use of this property.

this.dataGridView1.DefaultCellStyle.WrapMode =
    DataGridViewTriState.True;
Me.dataGridView1.DefaultCellStyle.WrapMode = DataGridViewTriState.True

備註

如果 WrapModeFalse 包含文字的資料格,則資料格會將文字顯示在同一行,並將任何內嵌的分行符號顯示為方塊字元。If WrapMode is False for a cell that contains text, the cell displays the text on a single line, and displays any embedded newline characters as box characters. 如果 WrapModeTrue 包含文字的資料格,則資料格會將分行符號顯示為分行符號,但也會將超出儲存格寬度的任何行換行。If WrapMode is True for a cell that contains text, the cell displays newline characters as line breaks, but also wraps any lines that exceed the width of the cell.

適用於

另請參閱