1、效果
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; }
调用
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、效果
protected virtual RepositoryItemPopupContainerEdit CreateRepositoryItemPopupContainerEdit(string caption) { RepositoryItemPopupContainerEdit repositoryPop = new RepositoryItemPopupContainerEdit(); //repositoryCalc.AutoHeight = false; repositoryPop.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Near; return repositoryPop; }
调用
//添加按钮 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列
3、效果 效果1的另一种方式
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;
4、效果
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; }
调用
RepositoryItemHyperLinkEdit linkSalesMoney = CreateRepositoryItemHyperLinkEdit("销售金额"); 2 linkSalesMoney.OpenLink += new OpenLinkEventHandler(linkSalesMoney_OpenLink); //事件 3 this.SalesMoney.ColumnEdit = linkSalesMoney; //绑定
标签:控件,手动,ripce,Add,RepositoryItemButtonEdit,repositoryBtn,rBtnEdit,new,GridControl From: https://www.cnblogs.com/skyhorseyk/p/17317422.html