public static BandedGridColumn CotPLDong(GridControl GridCtrl, BandedGridView Grid, bool isConfirmDelete) { DevExpress.XtraEditors.Repository.RepositoryItemButtonEdit repositoryItemButtonEditDEL = new DevExpress.XtraEditors.Repository.RepositoryItemButtonEdit(); repositoryItemButtonEditDEL.AutoHeight = false; repositoryItemButtonEditDEL.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder; repositoryItemButtonEditDEL.Buttons.Clear(); repositoryItemButtonEditDEL.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Delete, "", 10, true, true, false, DevExpress.Utils.HorzAlignment.Center, null, new DevExpress.Utils.KeyShortcut((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Delete)))}); repositoryItemButtonEditDEL.Name = "repositoryItemButtonEditDEL"; repositoryItemButtonEditDEL.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.HideTextEditor; // repositoryItemButtonEditDEL.KeyUp += delegate(object sender, KeyEventArgs e) // { // if (e.KeyData == Keys.Enter) // Grid.DeleteRow(Grid.FocusedRowHandle); // }; repositoryItemButtonEditDEL.Click += delegate(object sender, EventArgs e) { if (isConfirmDelete) { if (PLMessageBox.ShowConfirmMessage("Bạn có muốn xóa dòng này không ?") == DialogResult.Yes) Grid.DeleteRow(Grid.FocusedRowHandle); } else { Grid.DeleteRow(Grid.FocusedRowHandle); } }; GridCtrl.RepositoryItems.Add(repositoryItemButtonEditDEL); BandedGridColumn CotXoa = new BandedGridColumn(); CotXoa.AppearanceHeader.Options.UseTextOptions = true; CotXoa.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; CotXoa.AppearanceCell.Options.UseTextOptions = true; CotXoa.AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; CotXoa.Caption = " "; CotXoa.ColumnEdit = repositoryItemButtonEditDEL; CotXoa.Name = "CotXoa"; CotXoa.OptionsColumn.AllowSize = false; CotXoa.OptionsColumn.FixedWidth = true; CotXoa.Visible = true; CotXoa.VisibleIndex = 50; CotXoa.Width = 25; GridBand gridBand = new GridBand(); gridBand.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; gridBand.Columns.Add(CotXoa); gridBand.MinWidth = 10; gridBand.Name = "gridBandCotXoa"; gridBand.Caption = " "; gridBand.OptionsBand.AllowSize = false; gridBand.Width = 10; Grid.Bands.Add(gridBand); Grid.Columns.Add(CotXoa); //Grid.Columns.Add(CotXoa); return CotXoa; }