我有将列和按钮添加到 gridControl 的代码
private void btnDown_Click(object sender, EventArgs e)
{
DataRow r = dt.NewRow();
r[0] = cmbProject.Text;
r[1] = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "Le Nom").ToString();
r[2] = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "Quantité Restante");
r[3] = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "Longueur");
dt.Rows.Add(r);
deleteButton = new RepositoryItemButtonEdit();
deleteButton.Buttons[0].Kind = ButtonPredefines.Delete;
GridColumn column = gridView2.Columns["Projet"];
column.ColumnEdit = deleteButton;
column.ShowButtonMode = ShowButtonModeEnum.ShowAlways;
deleteButton.ButtonClick += btnDelete_Click;
}
这是我的按钮 btnDelete 代码
private void btnDelete_Click(object sender, EventArgs e)
{
gridView2.DeleteSelectedRows();
}
所有代码工作正常,但我无法让 deleteButton 删除 gridview 中的选定行,谁能帮助我,我正在使用 DevExpress WinForms GridControl。