DevExpress GridView 表格内嵌ButtonEdit按钮列图片按钮及Click事件
作者:C/S框架网|www.cscode.ne  发布日期:2021-03-03 20:02:21
  DevExpress GridView 表格内嵌ButtonEdit按钮列图片按钮及Click事件

如下图所示,在表格中添加按钮列,并绑定Click事件。

贴图图片-buttonedit



在表格中添加列,ColumnEdit属性选择ButtonEdit, 改名:btnCustomerDetail。


贴图图片-buttonedit1



贴图图片-buttonedit2



.Designer.cs代码参考:


C# Code:

this.btnOrderDetail.AutoHeight = false;

this.btnOrderDetail.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Glyph, "", -1, true, true, false, DevExpress.XtraEditors.ImageLocation.MiddleCenter, ((System.Drawing.Image)(resources.GetObject("btnOrderDetail.Buttons"))), new DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None), serializableAppearanceObject2, "", null, null, true)});

this.btnOrderDetail.ButtonsStyle = DevExpress.XtraEditors.Controls.BorderStyles.HotFlat;

this.btnOrderDetail.Name = "btnOrderDetail";

this.btnOrderDetail.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.HideTextEditor;

//来源:C/S框架网 | www.csframework.com | QQ:23404761




给btnCustomerDetail按钮绑定Click事件:


C# Code:

btnCustomerDetail.ButtonClick += BtnCustomerDetail_ButtonClick;


private void BtnCustomerDetail_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
{
  
if (gvSummary.FocusedRowHandle >= 0)
  {
    
string cid = gvSummary.GetFocusedDataRow()["CustomerId"].ToStringEx();
    frmCustomerDetailWebPage.ShowMe(frmMain.Instance, cid);
  }
}

//来源:C/S框架网 | www.csframework.com | QQ:23404761






C/S框架网|原创精神.创造价值.打造精品

扫一扫加微信
C/S框架网作者微信 C/S框架网|原创作品.质量保障.竭诚为您服务




上一篇 下一篇