Introduction

First of all, thanks to everyone. I am grateful to know that people value this effort. I remember like yesterday when I was sixteen, more or less, and I saw many types of software, apps and games. For me, it was impossible to access and develop software then. I have learned a lot since, however, and I realize that it's now one million times easier to access this kind of software. Furthermore, if I can help anyone to create eye-candy apps, I've decided that they can use my code freely.

Background

I was thinking about how to make a fully customizable button and about how difficult it was changing RGB components. I decided to make RibbonColor, which has many options to operate with colors. If you play the demo app, you will understand quickly as you move the Hue, Sat and Brightness track bar. I have to admit that I have approximately 70% of the new RibbonControl library finished. However, as people are anxious to have improved code and have told me that I did not explain practically anything about my code, I've decided to do this like for dummies. So, here we go.

How to Use the Code

First of all, create a new Windows application. From the Solution Explorer, choose the option Add Existing Item. Then choose RibbonMenuButton.cs and Rebuild the project. Now, if you go to the form1 designer, in the toolbox you will have RibbonMenuButton. Drag it to the form. You will see a control without sense, but let's play with the properties. First, set properties for the RibbonMenuButton:

When you have set the properties, add an image, set the text you want and set the font to Segoe UI if you have it. You will have something like this:

If you have compiled the project and you get this, the next step is to change the properties of the control. Let's see what each property represents. I recommend that you look at the button's Properties settings in the demo project:

Arrow: Paints an arrow ToRight or ToDown; this only paints, as the double functionality is in another property.

Colors: I think this doesn't need explanation; I recommend you to use the PlayGround app to choose your colors.

It is really sad that this control is rated so highly (perception rules) as it was very poorly written and is barely usable within a real application. Still, the overall drawing concepts were reasonable so I decided to spend 4 hours or so trying to make it more reasonable. After the 4 hours I think most of the common problems are resolved but I stopped once the basic functionality was no longer complete junk. All in all, this control could have been written correctly in about 4 hours so I don't think there is any point in wasting more time on it, but if I fix any other bugs I will update my solution (but not this post.)

The re-factoring will break existing code but most of the changes are relatively easy to fix.
The solution below is VS 2010. You can obviouly jack the code into the existing solution...but I leave that up to you.