1、barSubItem.AddItem(barButtonItem);4.奇怪的删除Page问题 while (this.ribbonControl.Pages.Count 0) ribbonControl.Pages.Remove(ribbonControl.Pages0); /调试正常,运行报异常 ribbonControl.SelectedPage = ribbonControl.Pages0;ribbonControl.Pages.Remove(ribbonControl.SelectedPage); /运行正常 5.RIBBON问题汇集 /禁止F10键Tips ribbonContro
2、l.Manager.UseF10KeyForMenu = false; /DX按钮 ApplicationIcon属性改变图标 右键 Add ApplicationMenu 添加evExpress.XtraBars.Ribbon.ApplicationMenu5.HitInfo /在Tab页上点击右键的事件响应 void xtraTabbedMdiManager_Event(object sender, MouseEventArgs e) if (e.Button = MouseButtons.Right & ActiveMdiChild != null) DevExpress.XtraTab
3、.ViewInfo.BaseTabHitInfo hInfo = xtraTabbedMdiManager.CalcHitInfo(e.Location);/右键点击位置:在Page上且不在关闭按钮内 if (hInfo.IsValid & hInfo.Page != null & !hInfo.InPageCloseButton) this.popupMenu.ShowPopup(Control.MousePosition);/在鼠标位置弹出,而不是e.Location /在ribbon上点击右键的事件响应 private void ribbonControl1_ShowCustomizat
4、ionMenu(object sender, RibbonCustomizationMenuEventArgs e) /禁掉原系统右键菜单 e.ShowCustomizationMenu = false;/右键位置:在barButtonItem上 if (e.HitInfo != null e.HitInfo.InItem e.HitInfo.Item.Item is BarButtonItem) 在barSubItem中的barButtonItem上 else if (e.Link ! e.Link.Item ! e.Link.Item is BarButtonItem) 6.皮肤 /添加皮
5、肤程序集后注册皮肤 DevExpress.UserSkins.OfficeSkins.Register();DevExpress.UserSkins.BonusSkins.Register();/设置皮肤 DevExpress.LookAndFeel.UserLookAndFeel.Default.SetSkinStyle(Liquid Sky); /若皮肤名称错误则按系统默认设置(第一个皮肤) /GalleryFilterMenuPopup事件设置弹出筛选菜单的“All Groups”为中文 private void rgbiSkins_GalleryFilterMenuPopup(obje
6、ct sender, GalleryFilterMenuEventArgs e) e.FilterMenu.ItemLinksn.Caption = 所有皮肤 /n=分组数+1 /GalleryInitDropDownGallery事件设置弹出皮肤列表的表头“ALL Groups”为中文 private void rgbiSkins_GalleryInitDropDownGallery(object sender, InplaceGalleryEventArgs e) e.PopupGallery.FilterCaption = 7.dockManager 将视图的状态信息保存到xml文件 d
7、ockManager1.SaveLayoutToXml(.UserConfigViewInfo.xml 导出xml中保存的状态信息 dockManager1.RestoreLayoutFromXml(8.barManager 设置bar的字体与系统字体 barAndDockingController1.AppearancesBar.ItemsFont = new Font(this.Font.FontFamily, currentFontSize);9.设置系统字体 DevExpress.Utils.AppearanceObject.DefaultFont = new Font(this.Fo
8、nt.FontFamily, currentFontSize);10.treeView 为tree节点加右键菜单并选中该节点 private void treeList1_MouseDown(object sender, MouseEventArgs e) if (e.Button = MouseButtons.Right) DevExpress.XtraTreeList.TreeListHitInfo hi = treeList1.CalcHitInfo(e.Location);if (hi.Node ! hi.Node.ImageIndex = 5) /叶子节点的ImageIndex =
9、5 TreeListNode node = treeList1.FindNodeByID(hi.Node.Id);treeList1.FocusedNode = node;this.popupMenu1.ShowPopup(MousePosition);二、DevExpress部分使用技巧(原创) 作者 : 轻舞肥羊 标题 : DevExpress部分使用技巧(原创) 关键字: DevExpress,cxGrid 分类 : 开发技巧 密级 : 公开 (评分:? , 回复: 7, 阅读: 8588) »本文由 轻舞肥羊 发表于 大富翁论坛 转载请标明出处,谢谢 声明:以下代码请看懂再
10、使用,本人水平有限,发现bug希望提出,让我们共同改进 2004-1-10 17:06:00 查看评语&1.扩展cxLookupComboBox,使其支持多列查询的cxLookupComboBoxEx 日期:08:06 /= / Unit Name: cxLookupComboBoxEx / Author : ysai / Date : 2003 / Purpose : 扩展cxLookupComboBox,cxDBLookupComboBox,使其支持多列过滤 / History :/ 2003-05-28大数据量改进 / 2003-07-07可操作性改进 / 2003-08-20效率改进
11、/ 2003-08-29加入过滤延时 / 注意:/ 限制1,不能再使用Properties.OnChange事件 / 限制2,不能再使用Properties.ListSource.DataSet.OnFilterRecord事件 / 限制3,不能再使用Properties.ListSource.DataSet.Filtered属性 / 其它,最好在设计期设好一切属性,运行期再设置属性可能引发求知错误 /=unit cxLookupComboBoxEx;interface uses SysUtils, Classes, Controls, Windows, Messages,DB,StrUtil
12、s, cxControls, cxContainer, cxEdit, cxTextEdit, cxMaskEdit, cxDropDownEdit, cxLookupEdit, cxDBLookupEdit, cxDBLookupComboBox;type TcxLookupComboBoxEx = class(TcxLookupComboBox) private /保存要过滤的字段列表 FFieldList : TList;FFindText : String;/过滤事件 procedure _OnFilterRecord(DataSet: TDataSet; var Accept: Bo
13、olean);/编辑框文字改变事件 procedure _OnChange(Sender : TObject);procedure GetFieldList;/延时过滤消息 procedure WMTimer (var Message: TMessage); message WM_TIMER;protected /下拉表格收回时 procedure CloseUp(AAccept: override;/过滤过程 procedure _FilterListSource;/初始化下拉表格事件 procedure DoInitPopup;public constructor Create(AOwne
14、r : TComponent);destructor Destroy;/更新要过滤的字段列表 procedure UpdateFilterFields;published end;TcxDBLookupComboBoxEx = class(TcxDBLookupComboBox) /取得要过滤的字段列表 procedure Register;implementation const UM_TIMER_FILTER = WM_USER + $101; /自定义延时消息ID FILTERTIMER = 500; /延时时间 DROPDOWN_ROWS = 12;begin RegisterComp
15、onents(Dev Express, TcxLookupComboBoxEx,TcxDBLookupComboBoxEx); TcxLookupComboBoxEx procedure TcxLookupComboBoxEx.CloseUp(AAccept:inherited;/收起下拉后取消过滤 if Assigned(Properties.ListSource) then if Assigned(Properties.ListSource.DataSet) then Properties.ListSource.DataSet.Filtered := False; end;construc
16、tor TcxLookupComboBoxEx.Create(AOwner: begin /默认值 Properties.AutoSelect :Properties.DropDownAutoSize := True;Properties.DropDownListStyle := lsEditList;Properties.DropDownRows := DROPDOWN_ROWS;Properties.DropDownSizeable :Properties.IncrementalFiltering :Properties.Revertable :Properties.OnChange :=
17、 _OnChange;Properties.UseLeftAlignmentOnEditing :destructor TcxLookupComboBoxEx.Destroy;/释放过滤字段列表 if Assigned(FFieldList) then FFieldList.Free;procedure TcxLookupComboBoxEx.DoInitPopup;/取得过滤字段 GetFieldList;inherited DoInitPopup;procedure TcxLookupComboBoxEx._FilterListSource; /过滤字段 if Assigned(Prope
18、rties.ListSource) and Assigned(Properties.ListSource.DataSet) then try Properties.ListSource.DataSet.DisableControls;Properties.ListSource.DataSet.OnFilterRecord := _OnFilterRecord;if Text then = Text;if SelLength 0 then = LeftStr(Text,SelStart);= FFindText Changed;finally Properties.ListSource.Data
19、Set.EnableControls;procedure TcxLookupComboBoxEx.GetFieldList; /取得过滤字段列表 var i : Integer;sFieldName :fdTemp : TField;if not Assigned(FFieldList) then = TList.Create;for i:=0 to Properties.ListColumns.Count -1 do = Properties.ListColumns.Itemsi.FieldName;if sFieldName = then Continue;= Properties.Lis
20、tSource.DataSet.FindField(sFieldName);if Assigned(fdTemp) then FFieldList.Add(Pointer(fdTemp);procedure TcxLookupComboBoxEx._OnChange(Sender: /设置延时 if Focused and DroppedDown then KillTimer(Handle,UM_TIMER_FILTER);SetTimer(Handle,UM_TIMER_FILTER,FILTERTIMER,nil);procedure TcxLookupComboBoxEx._OnFilt
21、erRecord(DataSet:var Accept:s := LowerCase(FFindText);if (s 0) then Accept :for i := 0 to FFieldList.Count -1 do = Pos(s,LowerCase(TField(FFieldListi).AsString)0;if Accept then Exit;end else procedure TcxLookupComboBoxEx.WMTimer(var Message:/延时更新消息 if Focused and DroppedDown then _FilterListSource;procedure TcxLookupComboBoxE
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1