Summary: devexpress10 tips

Source: Internet
Author: User
Devexpress is very popular. net Control, which is currently used by many users around the world and in China. However, because it is in English, it may be difficult for first-time contacts. Here we will summarize the 10 common usage skills of devexpress.

1. Texteditor (baredititem) to take the text

StringEditvalue = baredititem1.editvalue. tostring ();//Error. null is returned.
 
StringEditvalue = (devexpress. xtraeditors. textedit) baredititem). editvalue. tostring ();//Accurate, return text box content devexpress usage tips

2. Comboboxedit (baredititem) Add item

StringItem ="Comboboxitem1";
(Devexpress. xtraeditors. repository. repositoryitemcombobox)This. Baredititem. Edit). Items. Add (item );

3. Comboboxedit (baredititem) takes the text

StringItemvalue =This. Baredititem. editvalue. tostring ();

4. Ribbon Control

// Add page
Devexpress. xtrabars. ribbon. ribbonpage = New Ribbonpage ();
Ribboncontrol. pages. Add (ribbonpage );
// Add Group
Devexpress. xtrabars. ribbon. ribbonpagegroup = New Ribbonpagegroup ();
Ribbonpage. Groups. Add (ribbonpagegroup );
// Add button
Devexpress. xtrabars. barbuttonitem = New Barbuttonitem ();
Ribbonpagegroup. itemlinks. Add (barbuttonitem );
// Add barsubitem
Devexpress. xtrabars. barsubitem = New Barsubitem ();
Ribbonpagegroup. itemlinks. Add (barsubitem );
// Add a button under barsubitem
Barsubitem. additem (barbuttonitem );


// Strange page deletion problem (devexpress Tips)
While ( This . Ribboncontrol. pages. Count> 0 )
{
Ribboncontrol. pages. Remove (ribboncontrol. Pages [ 0 ]); // Debugging is normal and running reports exceptions
}
While ( This . Ribboncontrol. pages. Count> 0 )
{
Ribboncontrol. selectedpage = ribboncontrol. Pages [ 0 ];
Ribboncontrol. pages. Remove (ribboncontrol. selectedpage ); // Normal Operation
}
// Kill F10 Key Tips (devexpress Tips)
Ribboncontrol. Manager. usef10keyformenu = False ;
// DX button
Applicationicon attribute change icon
Right-click Add applicationmenu to add evexpress. xtrabars. ribbon. applicationmenu5.hitinfo

// Right-click the work response on the tab page (devexpress Tips)
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 the page and not in the closed button
If (HINFO. isvalid & HINFO. Page! = Null &&! HINFO. inpageclosebutton)
{
This . Popupmenu. showpopup (control. mouseposition ); // Pop up at the mouse position instead of E. Location
}
}
}
// Right-click the work response on Ribbon
Private Void Ribboncontrol1_showcustomizationmenu ( Object Sender, ribboncustomizationmenueventargs E)
{
// Disable the context menu of the original system
E. showcustomizationmenu = False ;
// Right-click on barbuttonitem
If (E. hitinfo! = Null
& Amp; E. hitinfo. initem
& Amp; E. hitinfo. item. Item Is Barbuttonitem)
{
This . Popupmenu. showpopup (control. mouseposition );
}
// Right-click on barbuttonitem in barsubitem
Else If (E. Link! = Null
& Amp; E. Link. item! = Null
& E. Link. Item Is Barbuttonitem)
{
This . Popupmenu. showpopup (control. mouseposition );
}
}

6. Skin

// Register the skin after adding a skin track set (devexpress Tips)
Devexpress. userskins. officeskins. Register ();
Devexpress. userskins. bonusskins. Register ();
// Set skin
Devexpress. lookandfeel. userlookandfeel. Default. setskinstyle ( " Liquid sky " ); // If the title of the skin is incorrect, it will be set by default (the first skin)
// Galleryfiltermenupopup work settings pop-up select "all groups" in the menu as Chinese
Private Void Rgbiskins_galleryfiltermenupopup ( Object Sender, galleryfiltermenueventargs E)
{
E. filtermenu. itemlinks [N]. Caption = " All skins " ; // N = number of groups + 1
}
// Galleryinitdropdowngallery settings
Private Void Rgbiskins_galleryinitdropdowngallery ( Object Sender, inplacegalleryeventargs E)
{
E. popupgallery. filtercaption = " All skins " ;
}

7. Dockmanager

Store View status information to an XML file
Dockmanager1.savelayouttoxml (".. \ Userconfig \ viewinfo. xml");
Export the status information stored in XML
Dockmanager1.restorelayoutfromxml (".. \ Userconfig \ viewinfo. xml");

8. Barmanager

Set the font and system font of Bar
Baranddockingcontroller1.appearancesbar. itemsfont =NewFont (This. Font. fontfamily, currentfontsize );

9. Set the system font

Devexpress. utils. appearanceobject. defaultfont =NewFont (This. Font. fontfamily, currentfontsize );

10. Treeview

Right-click 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 ) // Imageindex of the leaf node = 5
{
Treelistnode node = treelist1.findnodebyid (Hi. node. ID );
Treelist1.focusednode = node;

This . Popupmenu1.showpopup (mouseposition );
}
}
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.