http://blog.csdn.net/davinciyxw/article/details/5604209
1.TextEditor (Baredititem) fetching text
String editValue = BarEditItem1.EditValue.ToString (); Error, return null
String editValue = ((DevExpress.XtraEditors.TextEdit) baredititem). Editvalue.tostring (); Correct, return text box contents
2.ComboBoxEdit (baredititem) Add Item
String item = "ComboboxItem1";
((DevExpress.XtraEditors.Repository.RepositoryItemComboBox) this.barEditItem.Edit). Items.Add (item);
3.ComboBoxEdit (Baredititem) fetching text
String itemvalue = This.barEditItem.EditValue.ToString ();
4.Ribbon controls
Add page
DevExpress.XtraBars.Ribbon.RibbonPage ribbonpage = new Ribbonpage ();
RIBBONCONTROL.PAGES.ADD (Ribbonpage);
Add Group
DevExpress.XtraBars.Ribbon.RibbonPageGroup Ribbonpagegroup = new Ribbonpagegroup ();
RIBBONPAGE.GROUPS.ADD (Ribbonpagegroup);
Add button
DevExpress.XtraBars.BarButtonItem Barbuttonitem = new Barbuttonitem ();
RIBBONPAGEGROUP.ITEMLINKS.ADD (Barbuttonitem);
Add Barsubitem
DevExpress.XtraBars.BarSubItem Barsubitem = new Barsubitem ();
RIBBONPAGEGROUP.ITEMLINKS.ADD (Barsubitem);
Add button under Barsubitem
Barsubitem.additem (Barbuttonitem);
Strange Removal of page problems
while (This.ribbonControl.Pages.Count > 0)
{
RibbonControl.Pages.Remove (Ribboncontrol.pages[0]); Debug normal, run report exception
}
while (This.ribbonControl.Pages.Count > 0)
{
Ribboncontrol.selectedpage = Ribboncontrol.pages[0];
RibbonControl.Pages.Remove (Ribboncontrol.selectedpage); Operating normally
}
Prohibit F10 Key Tips
RibbonControl.Manager.UseF10KeyForMenu = false;
DX button
ApplicationIcon Property Change Icon
Right-click Add Applicationmenu evExpress.XtraBars.Ribbon.ApplicationMenu
5.HitInfo
Right-click event response on the tab page
void Xtratabbedmdimanager_event (object sender, MouseEventArgs e)
{
if (E.button = = Mousebuttons.right && activemdichild! = null)
{
DevExpress.XtraTab.ViewInfo.BaseTabHitInfo hInfo = Xtratabbedmdimanager.calchitinfo (e.location);
Right-click Location: on page and not inside the close button
if (hinfo.isvalid && hinfo.page! = null &&!hinfo.inpageclosebutton)
{
This.popupMenu.ShowPopup (control.mouseposition);//eject at mouse position instead of E. Location
}
}
}
Right-click event response on the Ribbon
private void Ribboncontrol1_showcustomizationmenu (object sender, Ribboncustomizationmenueventargs e)
{
Disable the original system right-click menu
E.showcustomizationmenu = false;
Right-click Position: On Barbuttonitem
if (e.hitinfo! = null
&& E.hitinfo.initem
&& E.hitinfo.item.item is Barbuttonitem)
{
This.popupMenu.ShowPopup (control.mouseposition);
}
Right-click: on Barbuttonitem in Barsubitem
else if (e.link! = null
&& E.link.item! = null
&& E.link.item is Barbuttonitem)
{
This.popupMenu.ShowPopup (control.mouseposition);
}
}
6. Skin
Registering skins after adding skin assemblies
DevExpress.UserSkins.OfficeSkins.Register ();
DevExpress.UserSkins.BonusSkins.Register ();
Set Skin
DevExpress.LookAndFeel.UserLookAndFeel.Default.SetSkinStyle ("Liquid Sky"); If the skin name is wrong, press system default settings (first skin)
Galleryfiltermenupopup Event Settings Pop-up Filter menu "All Groups" is Chinese
private void Rgbiskins_galleryfiltermenupopup (object sender, Galleryfiltermenueventargs e)
{
E.filtermenu.itemlinks[n]. Caption = "all Skins"; n= Number of groups +1
}
Galleryinitdropdowngallery Event Settings Popup Skin list Header "All Groups" for Chinese
private void Rgbiskins_galleryinitdropdowngallery (object sender, Inplacegalleryeventargs e)
{
E.popupgallery.filtercaption = "all Skins";
}
7.dockManager
Saving the view's state information to an XML file
Dockmanager1.savelayouttoxml (".. Userconfig//viewinfo.xml ");
To export saved state information in XML
Dockmanager1.restorelayoutfromxml (".. Userconfig//viewinfo.xml ");
8.barManager
Set the bar's font and system font
BarAndDockingController1.AppearancesBar.ItemsFont = new Font (this. Font.fontfamily, currentfontsize);
9. Set the system font
DevExpress.Utils.AppearanceObject.DefaultFont = new Font (this. Font.fontfamily, currentfontsize);
10.treeView
Add a right-click menu to the tree node and select the node
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)//leaf node ImageIndex = = 5
{
Treelistnode node = Treelist1.findnodebyid (hi. Node.id);
Treelist1.focusednode = node;
This.popupMenu1.ShowPopup (mouseposition);
}
}
}
Delphi Ribbon Use