在 DataGridView 的默认新行中显示文本?
Show text in DataGridView's default new row?
如果 DataGridView
设置为允许编辑新行,是否可以在其默认新行中显示字符串,例如。 "Click here to enter new item..."
在设计模式中打开 Columns
属性 编辑器(在属性 window 中)并为列集 DefaultCellStyle
NullValue = "Click here to enter new item...";
生成的代码(在 InitializeComponent()
方法中)看起来像
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1
= new System.Windows.Forms.DataGridViewCellStyle();
dataGridViewCellStyle1.NullValue = "Click here to enter new item...";
this.Column1.DefaultCellStyle = dataGridViewCellStyle1;
如果 DataGridView
设置为允许编辑新行,是否可以在其默认新行中显示字符串,例如。 "Click here to enter new item..."
在设计模式中打开 Columns
属性 编辑器(在属性 window 中)并为列集 DefaultCellStyle
NullValue = "Click here to enter new item...";
生成的代码(在 InitializeComponent()
方法中)看起来像
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1
= new System.Windows.Forms.DataGridViewCellStyle();
dataGridViewCellStyle1.NullValue = "Click here to enter new item...";
this.Column1.DefaultCellStyle = dataGridViewCellStyle1;