How to use Ribbon Control in C#
By FoxLearn 11/18/2024 11:16:48 PM 9.98K
The Ribbon Control replaces traditional toolbars and menus with tabbed pages. Each Page splits into Groups that contain various command buttons.
How to use Ribbon Control in C#
Ensure you have DevExpress installed in your Visual Studio and that you have access to the DevExpress controls.
If you have not yet installed DevExpress .NET products, you can view How to download and install DevExpress
Create a new Windows Forms Application project.
- Select File > New > Project.
- Choose Windows Forms App
- Name your project and click Create.
Next, Add new ribbon form, then enter with name is frmMain.
Drag the ImageCollection, DocumentManager and DefaultLookAndFeel from the visual studio toolbox to your main form.
The ImageCollection control allows you to add images and display the images to another control, the you can add the ImageCollection to the Ribbon form to display images for items.
The DocumentManager allows you to manage your form in the tabbed pages.
The DefaultLookAndFeel allows you to change theme for the windows forms application.
Next, To create the Module1 form you can right click on your project, then add the new XtraForm. You can add the LayoutControl to your XtraForm, then drag the TextBoxEdit, GridControl from devexpress toolbox into your LayoutControl.
Your module 1 name: frmModule1
Do the same way for Module2 and Module3 forms.
Your module 2 name: frmModule2
Your module 3 name: frmModule3
And don't forget to set your main form is the MDI form. Next, add code to handle your main form as shown below.
using DevExpress.XtraBars; namespace RibbonDemo { public partial class frmMain : DevExpress.XtraBars.Ribbon.RibbonForm { public frmMain() { InitializeComponent(); } private void barButtonItem3_ItemClick(object sender, ItemClickEventArgs e) { frmModule1 frm = new frmModule1(); frm.MdiParent = this; frm.Show(); } private void barButtonItem2_ItemClick(object sender, ItemClickEventArgs e) { frmModule2 frm = new frmModule2(); frm.MdiParent = this; frm.Show(); } private void barButtonItem1_ItemClick(object sender, ItemClickEventArgs e) { frmModule3 frm = new frmModule3(); frm.MdiParent = this; frm.Show(); } } }
So, Through the above example, you have learned how to use ribbon control in c# windows application and devexpress tabbed form.
VIDEO TUTORIAL
- How to Download and Install DevExpress
- How to use DevExpress Themes/Skins in C#
- How to use DevExpress Project Converter
- How to get icons from the DX Image Gallery
- How to set default font for RichEditControl
- How to Clear content in RichEditControl
- How to use CheckedComboBoxEdit with SearchControl in C#
- How to Create a Radial Menu in C#