共用方式為


DataGridView.Locked Property

Definition

Gets or sets a value that indicates whether the DataGridView can be modified at design time when the sheet is protected.

public:
 property bool Locked { bool get(); void set(bool value); };
[System.ComponentModel.Browsable(false)]
public bool Locked { get; set; }
[<System.ComponentModel.Browsable(false)>]
member this.Locked : bool with get, set
Public Property Locked As Boolean

Property Value

true if the DataGridView cannot be modified at design time when the sheet is protected; otherwise, false.

Attributes

Examples

For a code example that demonstrates how to use this property, see Microsoft.Office.Tools.Excel.Controls.Button.Locked. All controls in the Microsoft.Office.Tools.Excel.Controls namespace have a functionally equivalent Locked property.

Remarks

A DataGridView can only be locked when the sheet is protected. A locked DataGridView cannot be moved or resized at design time.

Applies to