方法一:
步骤1、在run designer中的设置
Views --> Options --> OptionsBehavior --> Enabled属性设置为true;
步骤2、C#代码
在Load函数调用: this.bandedGridView1.ShowingEditor += BandedGridView1_ShowingEditor;
BandedGridView1_ShowingEdito方法:
//只有DaoBanXS列可编辑
private void BandedGridView1_ShowingEditor(object sender, CancelEventArgs e)
{
if (this.bandedGridView1.FocusedColumn.FieldName !=“DaoBanXS”)
{
e.Cancel = true; //列不可编辑
}
}
方法二:
步骤1相同
步骤2、在run designer中的设置
Columns --> Options --> OptionsColumn–> AllowEdit属性设置为true; --允许编辑(默认值)
Columns --> Options --> OptionsColumn–> AllowEdit属性设置为false; --不允许编辑