1.1 创建一个RepositoryItemButtonEdit方法 private RepositoryItemButtonEdit CreateRepositoryItemButtonEdit(Dictionary<object, string> dicButtons) { RepositoryItemButtonEdit repositoryBtn = new RepositoryItemButtonEdit(); repositoryBtn.AppearanceDisabled.Options.UseTextOptions = true; repositoryBtn.AppearanceDisabled.TextOptions.HAlignment = HorzAlignment.Near; repositoryBtn.AutoHeight = false; repositoryBtn.TextEditStyle = TextEditStyles.HideTextEditor; repositoryBtn.ButtonsStyle = BorderStyles.UltraFlat; repositoryBtn.Buttons.Clear(); EditorButton btn = null; foreach (KeyValuePair<object, string> item in dicButtons) { btn = new EditorButton(); btn.Kind = ButtonPredefines.Glyph; btn.Caption = item.Value; btn.Tag = item.Key; repositoryBtn.Buttons.Add(btn); } return repositoryBtn; }
1.2 开始调用 Dictionary<object, string> dicButtons = new Dictionary<object, string>(); dicButtons.Add("delete", "删除"); dicButtons.Add("download", "下载"); RepositoryItemButtonEdit ribeFile = CreateRepositoryItemButtonEdit(dicButtons); //ribeFile.ButtonClick += ribeFile_ButtonClick; //绑定事件 gcData.RepositoryItems.Add(ribeFile); this.Operate.ColumnEdit = ribeFile;
2.另外一种方式
RepositoryItemButtonEdit rBtnEdit = new RepositoryItemButtonEdit(); rBtnEdit.Buttons.Clear(); rBtnEdit.TextEditStyle = TextEditStyles.DisableTextEditor; rBtnEdit.ButtonsStyle = BorderStyles.Default; rBtnEdit.Appearance.BackColor = this.ReceivableDate.AppearanceCell.BackColor; rBtnEdit.ButtonClick += rBtnEdit_ButtonClick;//绑定事件 EditorButton btnSet = new EditorButton(); btnSet.Tag = "set"; btnSet.Kind = ButtonPredefines.Glyph; btnSet.ToolTip = "设置延迟日期"; btnSet.Caption = "设置"; rBtnEdit.Buttons.Add(btnSet); gcData.RepositoryItems.Add(rBtnEdit); this.ReceivableDate.ColumnEdit = rBtnEdit;
3.1 创建一个RepositoryItemPopupContainerEdit
protected virtual RepositoryItemPopupContainerEdit CreateRepositoryItemPopupContainerEdit(string caption) { RepositoryItemPopupContainerEdit repositoryPop = new RepositoryItemPopupContainerEdit(); //repositoryCalc.AutoHeight = false; repositoryPop.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Near; return repositoryPop; }
3.2 开始调用 //添加按钮 EditorButton edit = new EditorButton(); edit.Kind = DevExpress.XtraEditors.Controls.ButtonPredefines.Plus; edit.ToolTip = "添加";//提示 edit.Tag = "add"; RepositoryItemPopupContainerEdit ripce = CreateRepositoryItemPopupContainerEdit("标签"); ripce.PopupControl = this.popTags; //popupContainerControl控件 ripce.QueryPopUp += ripce_QueryPopUp; //弹出控制事件 ripce.QueryResultValue += ripce_QueryResultValue; //返回值事件 ripce.Buttons.Add(edit); ripce.ButtonClick += ripce_ButtonClick; //添加按钮事件 gcFile.RepositoryItems.Add(ripce); this.TagName.ColumnEdit = ripce; //TagName是GridView的gridColumn列
4.1 创建一个RepositoryItemHyperLinkEdit
protected virtual RepositoryItemHyperLinkEdit CreateRepositoryItemHyperLinkEdit(string caption) { RepositoryItemHyperLinkEdit link = new RepositoryItemHyperLinkEdit(); link.AutoHeight = false; link.TextEditStyle = TextEditStyles.Standard; link.ReadOnly = true; link.SingleClick = true; return link; }
4.2 开始调用
RepositoryItemHyperLinkEdit linkSalesMoney = CreateRepositoryItemHyperLinkEdit("销售金额"); linkSalesMoney.OpenLink += new OpenLinkEventHandler(linkSalesMoney_OpenLink); //事件 this.SalesMoney.ColumnEdit = linkSalesMoney; //绑定
来源:
https://www.cnblogs.com/qq-xiao/p/6122573.html
标签:GRIDVIEW,DEVEXPRESS,ripce,Add,RepositoryItemButtonEdit,repositoryBtn,rBtnEdit,按钮 From: https://www.cnblogs.com/ywtssydm/p/17280937.html