DataGridViewColumn.Resizable DataGridViewColumn.Resizable DataGridViewColumn.Resizable DataGridViewColumn.Resizable Property

定義

取得或設定值,指出資料行是否可以重新調整大小。Gets or sets a value indicating whether the column is resizable.

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

屬性值

範例

下列程式碼範例會使用此屬性來修正第三個數據行的大小,讓使用者無法變更資料行寬度。The following code example uses this property to fix the size of the third column so that the user cannot change the column width.

dataGridView1->Columns[ 2 ]->Resizable = DataGridViewTriState::False;

dataGridView1.Columns[2].Resizable =
    DataGridViewTriState.False;
DataGridView1.Columns(2).Resizable = DataGridViewTriState.False

備註

如果屬性為False,則使用者將無法手動調整資料行寬度。 ResizableIf the Resizable property is False, the user will not be able to manually adjust the column width.

根據預設, Resizable屬性值是以DataGridView.AllowUserToResizeColumns屬性值為基礎。By default, the Resizable property value is based on the DataGridView.AllowUserToResizeColumns property value. 不過,如果您ResizableTrue明確False設定為或,則會忽略控制項值。If you explicitly set Resizable to True or False, however, the control value is ignored. 設定ResizableNotSet以還原值繼承行為。Set Resizable to NotSet to restore the value-inheritance behavior.

因為NotSet會還原值繼承Resizable ,除非資料行尚未新增至NotSet DataGridView控制項,否則屬性永遠不會傳回值。Because NotSet restores the value inheritance, the Resizable property will never return a NotSet value unless the column has not been added to a DataGridView control. 如果您需要判斷資料行的Resizable屬性值是否已繼承,請檢查其State屬性。If you need to determine whether the Resizable property value of a column is inherited, check its State property. 如果屬性值ResizableSet包含旗標,則Resizable不會繼承屬性值。 StateIf the State property value includes the ResizableSet flag, the Resizable property value is not inherited.

適用於

另請參閱