C# 自定义DataGridViewColumn-在鼠标双击之前,单元格不会被绘制(可见)

C# 自定义DataGridViewColumn-在鼠标双击之前,单元格不会被绘制(可见),c#,.net,datagridview,datagridviewcolumn,C#,.net,Datagridview,Datagridviewcolumn,我需要为datagridview构建一个自定义DataGridViewColumn,以便。。。设想以下场景(框架): *PropertyEditor是国家仪器的一个组成部分。这是单元格的内容 因此,我以编程方式创建一列,然后添加: PropertyEditor propertyEditor = new PropertyEditor(); propertyEditor.Source = new PropertyEditorSource(new ScatterPlot(), "LineStep");

我需要为datagridview构建一个自定义DataGridViewColumn,以便。。。设想以下场景(框架):

*PropertyEditor是国家仪器的一个组成部分。这是单元格的内容

因此,我以编程方式创建一列,然后添加:

PropertyEditor propertyEditor = new PropertyEditor();
propertyEditor.Source = new PropertyEditorSource(new ScatterPlot(), "LineStep");
propertyEditor.SourceValue = "XYStep"; // Default value for property LineStep

PropertyEditorColumn col = new PropertyEditorColumn(propertyEditor);
this.dataGridView1.Columns.Add(col);
我的问题是,在DefaultNewRowValue中,this.propertyEdit为null,而不是通过参数传递的,因为添加列后会自动调用不带参数的CustomCell构造函数。我想用默认值初始化单元格,并将其作为参数传递。我怎样才能做到这一点


Thx.

我已经通过覆盖CustomCell中的clone方法并将propertyEditor添加到新克隆的单元格中解决了这个问题。很高兴您解决了这个问题。请添加一个答案并接受它,这样它就不会显示为未回答的问题。而且,它可能会帮助其他有同样问题的人。
PropertyEditor propertyEditor = new PropertyEditor();
propertyEditor.Source = new PropertyEditorSource(new ScatterPlot(), "LineStep");
propertyEditor.SourceValue = "XYStep"; // Default value for property LineStep

PropertyEditorColumn col = new PropertyEditorColumn(propertyEditor);
this.dataGridView1.Columns.Add(col);