日期:2014-05-18  浏览次数:21070 次

如何在datagridview项里面加按钮
就是说在项里面加上一个自定义控件,说按钮只是一个代称

------解决方案--------------------
路过接分~
------解决方案--------------------
System.Windows.Forms.DataGridViewButtonColumn btnCol= new System.Windows.Forms.DataGridViewButtonColumn();
this.btnCol.DefaultCellStyle = dataGridViewCellStyle1;
this.btnCol.HeaderText = "操作";
this.btnCol.Name = "btnCol";
this.btnCol.ReadOnly = true;
this.btnCol.Text = "采纳";
this.btnCol.Width = 50;
grdComparePice.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.btnCol});


 private void grdComparePice_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
if (grdComparePice.Columns[e.ColumnIndex].Name == "btnCol")
{
......
}
 }