DevExpress GridView 表格内嵌ButtonEdit按钮列图片按钮及Click事件
DevExpress GridView 表格内嵌ButtonEdit按钮列图片按钮及Click事件
扫一扫加微信
如下图所示,在表格中添加按钮列,并绑定Click事件。
在表格中添加列,ColumnEdit属性选择ButtonEdit, 改名:btnCustomerDetail。
.Designer.cs代码参考:
C# Code:
this.btnOrderDetail.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.HideTextEditor;
//来源:C/S框架网 | www.csframework.com | QQ:23404761
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)});
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
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
扫一扫加微信
版权声明:本文为开发框架文库发布内容,转载请附上原文出处连接
NewDoc C/S框架网