Tuesday, March 08, 2011

New .NET Ribbon Control

f you like this post, please visit our sponsors above. Thanks!

Recently I have been exploring the use of Ribbon Control. Yesterday, I posted a tutorial on its use with Windows Workflow Foundation. However, I am far more comfortable developing applications with Windows Forms . So, I searched for Ribbon Control for Windows Forms. Although I found an open source version here, there was no associated tutorial. So I decided to write one. In this tutorial I will explain how to create a simple windows forms application with a Ribbon Control and how to add buttons.

1. Download the Ribbon Control binaries here.

2. Create a Windows Forms Visual Studio Project.

3. Add reference to the downloaded System.Windows.Forms.Ribbon.dll

4. Chose Items and Browes the Ribbon dll and Add then you can see Ribbon controls on you
Item list.
5. Dreag and drop the Ribbon Penal and Ribbon Tab on your frm.

Your Windows Form Should look like this;



















From this point onward, adding controls to the ribbon should be easy.

5. To add a tab to your ribbon control, click ‘Add Tab’. I have added three tabs; Home, Data Manipulation and Visualization. As with any control, you can change the properties of the tabs using the properties grid.

6. Once the panels have been created, click a panel. The property grid shows options for the panel. Besides ‘Add Button’, these options include ‘Add Button List’, ‘Add Item Group’, ‘Add Separator’ etc. Click the ‘Add Button’ command. A button is created. You can use the property grid to set the text, tool tip and image for the button.

7. Ribbon Button click Event.

Private Sub RibbonButton7_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles RibbonButton1.Click
MsgBox("test")
End Sub
MsgBox("test")
End Sub



Congratulations! you have successfully added a ribbon control to your Windows Forms Application. You are good to go!

1 comment: