dev gridview表格按钮

固定列的位置

添加按钮控件位置,使用buttonEdit

添加按钮

按钮属性设置

按钮设置后的效果

//注册按钮事件
this.ribtndata.ButtonClick += new DevExpress.XtraEditors.Controls.ButtonPressedEventHandler(ribtndata_Click);

private void ribtndata_Click(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
{
if (e.Button.Index == 0)
{
//方法
}
if (e.Button.Index == 1)
{
//方法
}
}

 动态生成按钮

private RepositoryItemButtonEdit m_HandleBtn = new RepositoryItemButtonEdit();
for
(int i = 0; i < str.Count(); i++) { btn.Buttons[0].Kind = ButtonPredefines.Glyph;//初始的是有一个按钮 btn.Buttons[0].Caption = str[0]; btn.Buttons[0].Appearance.Options.UseForeColor = true; btn.Buttons[0].Appearance.ForeColor = Color.Black; if (i > 0) { btn.Buttons.Add(new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Glyph , str[i], -1, true, true, false, DevExpress.XtraEditors.ImageLocation.MiddleCenter, null , new DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None) , new DevExpress.Utils.SerializableAppearanceObject() { ForeColor = Color.Blue, Options = { UseBorderColor = true } } , "", null, null, true)); } // btn.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, null // , new DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None) // , new DevExpress.Utils.SerializableAppearanceObject(), "", null, null, true), //new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Glyph // , "处理", -1, true, true, false, DevExpress.XtraEditors.ImageLocation.MiddleCenter, null // , new DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None) // , new DevExpress.Utils.SerializableAppearanceObject(), "", null, null, true)}); } btn.ButtonsStyle = BorderStyles.Default; btn.TextEditStyle = TextEditStyles.HideTextEditor;

 

转载于:https://www.cnblogs.com/shuaimeng/p/9999938.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值