Click here to Skip to main content
13,732,335 members
Click here to Skip to main content
Add your own
alternative version


517 bookmarked
Posted 18 Apr 2007
Licenced CPOL

An easy way to add a Ribbon Panel Office 2007 style

, 18 Apr 2007
Rate this:
Please Sign up or sign in to vote.
GNU code of RibbonPanel, free software for personal and nonlucrative use, for rest please contact me
Screenshot - overview.jpg


A picture is worth a thousand words, well it was a really cute work at the end. Before explaining how to add it to your applications, I will show you the main features.

Features of RibbonStyle Namespace

  • RibbonButton: Transparency, Autosizable image, AutoForecolor, AutoInfoForm (see InfoForm, OnBackImage and ClickBackImage).
  • TabPanel: Transparency, BaseColor, BaseColorOn (Highlighted), Caption, Resizable.
  • TabStrip: Has inside:
    1. Tab: With Autowidth, BaseColor, HaloColor and Enable work.
    2. TabStripProffesionalRenderer: Controls the Tab Style (hard to work)
    3. TabStripPage: BaseColor, inherits my RibbonPanel.
    4. TabPageSwitcher: Controls the link between Tab and TabStripPage. Design functionality as the tabcontrol.
  • InfoForm (with Shadow): Depending on Title, Comment, and Image of Info.. Properties of RibbonButton resizes itself.

Using the controls

I hope that if you have understood the Features, the next will be easy for you.

  1. Make a new C# App.
  2. Add all the classes to your app.
  3. Now Rebuild the project.
  4. In the toolbox you will have many new controls:

    Screenshot - toolbox.jpg

  5. Now Add a Windows.Forms.Panel to the Form and dock to the top, adjust it like you want.
  6. Add the TabStrip inside the Panel.
  7. With the TabStripPageSwitcher you can add TabStrip. If you find it difficult to click on it, you can click in the properties window:
  8. Screenshot - tabpageswitcher.jpg

  9. With a TabStrip and some tabs and TabStrip pages, add TabPanels inside the TabStripPages (Check the TabPanel has BackColor.Transparent) . I recommend you to add a few of them to the form and copy and paste inside the tabStripPage (it is easy to dock them later). With the Tabpanels added, dock them to the left.
  10. Now add the RibbonButton inside the TabPanel, adjust its size and its images, copy and paste as you want and change the image. Don't worry about the text colors, they will be processed at runtime.
  11. If everything is ok and if you run it, you will see something like this (Azure Style):

    Screenshot - tabs.jpg

Creating your custom style

As you could see in the demo zip, it is possible to change the colors at runtime. Let's analyze the code. If you look at the Form1 code, there's a method SetStyle:

public void SetStyle(string Name)
    Color HaloColor = Color.White;
    switch (Name)
        case "Dark":
        this.BackColor = Color.FromArgb(88,77,69);
        HaloColor = Color.FromArgb(200,200,200);

You find out that you have to change only three colors! I hope you find it useful. The rest are sum or subs from the color components. So to avoid color errors, I recommend taking a look at my other article which has a color selector, only for the basecolor, HaloColor is the brightness over the tabs and the Backcolor is for the form.

Points of Interest

I have to say that I use the base of CustomTabstrip for the part of tabstrip. I was annoyed with the tabcontrol and after looking for something, the best was to inherit from a ToolStrip.

There's a lot of code in the project and I have written this with a lot of effort. If you need an explanation of any part, please ask me. It's .NET 2.0 code I put in a Windows 2000 machine and it works really well in XP and Vista too.

To design a better software, please vote the value of the code for you and if you vote, please tell me the pros and cons.


  • 1.0: The first version of the control library.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Juan Pablo G.C.
Software Developer Expediteapps
Spain Spain
I'm Electronic Engineer, I did my end degree project at Astrophysical Institute and Tech Institute. I'm HP Procurve AIS and ASE ,Microsoft 3.5 MCTS
I live in Canary Islands ,developing customized solutions

Deeply involved in Xamarin Forms LOB (including Azure Cloud with offline support, custom controls, dependencies) projects, WP8.1 & W10 projects, WPF modern styled projects. Portable libraries like portablePDF, portableOneDrive, portableReports and portablePrinting (using Google Printing API).

Web and apps showcase at:

Take a look to my blog

You may also be interested in...


Comments and Discussions

GeneralRe: Great Job! Pin
Kamalmostofi1-May-07 23:42
memberKamalmostofi1-May-07 23:42 
GeneralRe: Great Job! Pin
Kamalmostofi1-May-07 23:56
memberKamalmostofi1-May-07 23:56 
GeneralRe: Great Job! Pin
Kamalmostofi2-May-07 0:35
memberKamalmostofi2-May-07 0:35 
GeneralJuan - really great work !! Pin
Paul200730-Apr-07 19:41
memberPaul200730-Apr-07 19:41 
GeneralSi necesitas ayuda Pin
Fco. Javier Marin28-Apr-07 9:38
memberFco. Javier Marin28-Apr-07 9:38 
GeneralDaaaaayum. Pin
Marc Leger25-Apr-07 8:12
memberMarc Leger25-Apr-07 8:12 
GeneralInfo Form Dispose [modified] Pin
Azlan David25-Apr-07 5:20
memberAzlan David25-Apr-07 5:20 
GeneralRe: Info Form Dispose Pin
Torrey Betts25-Apr-07 7:22
memberTorrey Betts25-Apr-07 7:22 
GeneralRe: Info Form Dispose Pin
Azlan David25-Apr-07 8:03
memberAzlan David25-Apr-07 8:03 
GeneralFor people looking to fix the info shadow problem... Pin
Torrey Betts25-Apr-07 4:05
memberTorrey Betts25-Apr-07 4:05 
GeneralRe: For people looking to fix the info shadow problem... Pin
Juan Pablo G.C.25-Apr-07 4:09
memberJuan Pablo G.C.25-Apr-07 4:09 
GeneralA little bug Pin
Paolo Vernazza24-Apr-07 8:20
memberPaolo Vernazza24-Apr-07 8:20 
GeneralRe: A little bug Pin
Azlan David25-Apr-07 5:27
memberAzlan David25-Apr-07 5:27 
GeneralAmazing Pin
D_Guidi24-Apr-07 7:22
memberD_Guidi24-Apr-07 7:22 
GeneralNice work Pin
Amr Elsehemy ®24-Apr-07 4:54
memberAmr Elsehemy ®24-Apr-07 4:54 
GeneralRefactored some of the code Pin
Bert delaVega23-Apr-07 10:50
memberBert delaVega23-Apr-07 10:50 
GeneralRibbon and XAML Pin
D. Amberti23-Apr-07 3:59
memberD. Amberti23-Apr-07 3:59 
GeneralRe: Ribbon and XAML Pin
Juan Pablo G.C.23-Apr-07 4:13
memberJuan Pablo G.C.23-Apr-07 4:13 
GeneralRe: Ribbon and XAML Pin
Pete O'Hanlon24-Apr-07 9:56
memberPete O'Hanlon24-Apr-07 9:56 
GeneralRe: Ribbon and XAML Pin
Sacha Barber24-Apr-07 21:01
memberSacha Barber24-Apr-07 21:01 
GeneralRe: Ribbon and XAML Pin
Pete O'Hanlon24-Apr-07 22:44
memberPete O'Hanlon24-Apr-07 22:44 
GeneralRe: Ribbon and XAML Pin
WillemM28-Apr-07 4:25
memberWillemM28-Apr-07 4:25 
QuestionResize and usability Pin
D. Amberti23-Apr-07 2:24
memberD. Amberti23-Apr-07 2:24 
AnswerRe: Resize and usability Pin
Juan Pablo G.C.23-Apr-07 3:00
memberJuan Pablo G.C.23-Apr-07 3:00 
GeneralRe: Resize and usability Pin
Bert delaVega23-Apr-07 10:02
memberBert delaVega23-Apr-07 10:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web04-2016 | 2.8.180920.1 | Last Updated 18 Apr 2007
Article Copyright 2007 by Juan Pablo G.C.
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid