首页 > 代码库 > DevExpress常见的10个使用技巧

DevExpress常见的10个使用技巧

DevExpress是非常主流的.NET控件,目前全世界和中国都用很多用户使用,不过由于是英文版,初次接触的同学可能会觉得困难,这里就总结DevExpress常见的10个使用技巧。1.TextEditor(barEditItem)取文本 string editValue = http://www.mamicode.com/barEditItem1.EditValue.ToString();    //错误,返回null"comboboxItem1";((DevExpress.XtraEditors.Repository.RepositoryItemComboBox)this.barEditItem.Edit).Items.Add(item);3.ComboBoxEdit(barEditItem)取文本 string itemValue = http://www.mamicode.com/this.barEditItem.EditValue.ToString();"Liquid Sky");    //若皮肤称号错误则按系统默许设置(第一个皮肤)//GalleryFilterMenuPopup工作设置弹出选择菜单的“All Groups”为中文private void rgbiSkins_GalleryFilterMenuPopup(object sender, GalleryFilterMenuEventArgs e){    e.FilterMenu.ItemLinks[n].Caption = "一切皮肤";    //n=分组数+1}//GalleryInitDropDownGallery工作设置弹出皮肤列表的表头“ALL Groups”为中文private void rgbiSkins_GalleryInitDropDownGallery(object sender, InplaceGalleryEventArgs e){    e.PopupGallery.FilterCaption = "一切皮肤";}7.dockManager 将视图的状况信息保管到xml文件dockManager1.SaveLayoutToXml("..\\UserConfig\\ViewInfo.xml");导出xml中保管的状况信息dockManager1.RestoreLayoutFromXml("..\\UserConfig\\ViewInfo.xml");8.barManager 设置bar的字体与系统字体barAndDockingController1.AppearancesBar.ItemsFont = new Font(this.Font.FontFamily, currentFontSize);9.设置系统字体 DevExpress.Utils.AppearanceObject.DefaultFont = new Font(this.Font.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 != null && hi.Node.ImageIndex == 5) //叶子节点的ImageIndex == 5                {                    TreeListNode node = treeList1.FindNodeByID(hi.Node.Id);                    treeList1.FocusedNode = node;                     this.popupMenu1.ShowPopup(MousePosition);                }            }        }

  

DevExpress常见的10个使用技巧