【发布时间】:2012-02-11 19:24:59
【问题描述】:
有没有办法使用 c# 添加自定义 DatagridviewRow?
我已经为这些行做了一个类。
class CustomizeRow: System.Windows.Forms.DataGridViewRow
{
...
}
现在我可以添加一些我的自定义行
DataGridViewColumn column = new DataGridViewTextBoxColumn();
dataGridView1.Columns.Add(column);
CustomizeRow row = new CustomizeRow();
dataGridView1.Rows.Add(row);
但是当我使用绑定源添加这样的行时,我该如何处理
bs = new BindingSource();
bs.DataSource = dataSet1.Tables["Table"];
dataGridView1.DataSource = bs;
【问题讨论】:
-
你可以尝试使用onrowdatabound事件吗?
-
以前的贡献是解决方案。 Customrow rowtemp = new CustomRow(); dataGridView1.RowTemplate = rowtemp;
标签: c# .net datagridview customization