This project is read-only.

Content



How to Use - Step by Step Guide for Beginner


Reminder: Please note that this ribbon does not work on .Net 3.5 Client Profile and .NET 4.0 Client Profile. You have to manually switch the target framework to .NET 3.5 or .NET 4.0. When you first create a project, Visual Studio might initially set the target framework to Client Profile.

dotnet4.png

If the project is using Client Profile, you might receive this error while you are trying to build the solution:

Error 3 The type or namespace name 'Ribbon' does not exist in the namespace 'System.Windows.Forms' (are you missing an assembly reference?)


Note: The above warning is not applicable if you are using .NET Framework 2.0.

Lets start

1. Download the pre-compile DLL System.Windows.Forms.Ribbon35.dll.

2. Create a blank WinForms project.

01.png

3. Add Ribbon into Visual Studio Toolbox. Right Click on Toolbox > Add Tab.

addribbon01.png

4. Give the new born baby... no, I mean the tab... a name, how about calling it "Ribbon".

addribbon02.png

5. Right Click on the New Tab Ribbon > Choose Items...

addribbon03.png

6. Browse... Where are you? System.Windows.Forms.Ribbon35.dll?

addribbon04.png

7. There you are... Gotcha... Select it...

addribbon05.png

8. Only Ribbon can be dragged into Form. Others, as the picture below said, they are not needed to exist in toolbox. However, its not going to harm your computer or project if you select all the items belongs to ribbon (by default). Its up to you.

addribbon06.png

9. And finally, what you're going to do is just...

addribbon07.png

Another Way

Manually code it behind.

10. You can add the ribbon into WinForm too with code behind.

Add a reference of System.Windows.Forms.Ribbon35.dll into your project. Build the the solution.

Open Form.Designer.cs and add these three lines of code:

private System.Windows.Forms.Ribbon ribbon1;
ribbon1 = new System.Windows.Forms.Ribbon();
this.Controls.Add(ribbon1); 

Into Form1.Designer.cs:

private void InitializeComponent()
{
    ribbon1 = new System.Windows.Forms.Ribbon();
    this.components = new System.ComponentModel.Container();
    this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    this.Text = "Form1";
    this.Controls.Add(ribbon1);
}
private System.Windows.Forms.Ribbon ribbon1; 

Save and Close Form1.Designer.cs.

Double click and open Form1.cs, and now the Ribbon control is added into the main form.

06.png


Lets continue...


11. Click on the Ribbon and click Add Tab.

08.png

12. Click on the newly added RibbonTab, then click Add Panel.

09.png

13. Click on the newly added RibbonPanel, go to Properties. You will see a set of available controls that can be added to the RibbonPanel.

10.png

14. You might not able to see the extra command links of "Add Button", "Add ButtonList", "Add ItemGroup"... etc at the Properties Explorer.

10a.png

15. Right click at the Properties Explorer and Tick/Check the Commands.

10b.png

16. Try to add some buttons into the RibbonPanel.

17. Click on the RibbonButtons, go to Properties. Let's try to change the image and the label text of the button.

13.png

18. This is how your ribbon looks like now. Now, create the click event for the buttons. Click on RibbonButton, go to Properties, modify the Name of the button.

11.png

19. Click on the RibbonButton, go to properties > Click on Events > Double Click on event of Click.

rt.png

20. Events created.

public Form1()
{
    InitializeComponent();
}

void cmdNew_Click(object sender, EventArgs e)
{
    MessageBox.Show("Button \"New\" Clicked.");
}

void cmdSave_Click(object sender, EventArgs e)
{
    MessageBox.Show("Button \"Save\" Clicked.");
}

21. Press F5 to run the application. Done.

12.png

22. You might want to inherit your Main Form into a RibbonForm to have extra features. Such as:

14.png

Note: In the previous version of Ribbon, Inherit the Main Form to RibbonForm might cause some compatibility problems with some of the System.Windows.Forms controls. However this problem is solved in the released version of 10 May 2013.

23. In the code for Form1.cs, change this line:

public partial class Form1 : Form

24. to this line:

public partial class Form1 : RibbonForm

Last edited May 19 at 10:48 PM by dbell154, version 60

Comments

komerc Mar 31, 2015 at 6:45 PM 
Very bad! Does not work in VB2010. Kill this!!!

microdesigns2000 Aug 11, 2013 at 3:22 PM 
Wow! So useful. So easy to use. This is exactly what I was looking for! Thanks!!!

Vaughyman Jul 9, 2013 at 6:22 PM 
Unfortunately it's impossible to get the "Name" of any control like RibbonButton, RibbonPanel,...,
Any proprerty we can access, but this one.

adriancs Jun 13, 2013 at 5:27 AM 
Try not to ask questions in Comment.
Ask it at Discussion section.
This is because we can't respond to you properly here.

pasand Jun 6, 2013 at 9:11 PM 
Graet,
Some difficulties but great job.
Now a question: how fill a RibbonComboBox?

alsadi Dec 27, 2012 at 8:41 PM 
Se produjo una excepción de tipo 'System.ComponentModel.Design.ExceptionCollection'.

alsadi Dec 27, 2012 at 7:53 PM 
Error de desvordamiento de pila

UtilityBuilder Apr 11, 2012 at 11:13 PM 
How do you fix it?

NasirAmin Jan 5, 2012 at 5:31 PM 
This has some issues it terms of hooking up events against the controls.