Click here to Skip to main content
Click here to Skip to main content
Go to top

The new RibbonForm, RibbonRoundButton, and FastMenu

, 3 Jun 2007
Rate this:
Please Sign up or sign in to vote.
A free version of RibbonForm, RibbonRoundButton, and RibbonFastMenu.

Screenshot - RibbonTest.png

Introduction

In this article, I present the RibbonForm, RibbonRoundButton, and RibbonFastMenu as a release version. I present RibbonContextMenu as a preview version because I have to improve some parameters to work with it well.

The Controls

RibbonForm 1.0

Screenshot - RibbonForm.png

The RibbonForm was a bit difficult to design due to it being a modeless window, and I had to implement all the resizing and window moving by myself. Also, I had to implement a HSB method to change colors.

Properties

The RibbonForm has these properties:

  • CompB: To change the Brightness of the Form with a value that I recommend to get from the RibbonFormSample (see screenshot above).
  • CompS: To change the Saturation of the Form, the same as above.
  • CompH: To change the Hue of the Form, the same as above.
  • TextSection: It's the subtitle of the Form with the harmony color.

How to use

In a new Windows application, add an existing item from the Solution Explorer, and choose the RibbonForm.cs (it adds the other files needed). Now, in the Form1.cs code, change to this:

using RibbonStyle; //To add the NameSpace

namespace RibbonTest
{
    public partial class Form1 : RibbonForm //To inherit from RibbonForm
    {
        public Form1()
        {
            InitializeComponent();
        }
    }
} 

RibbonRoundButton 1.0

Screenshot - RibbonRound.png

It was really hard to design a vectorial round button with fading, but I think it finished well.

Properties

The RibbonRoundButton has these properties:

  • ColorBase, ColorOn, ColorPress: The typical colors.
  • ColorStroke: Is the border of the button.
  • ImgOffset: You can move the image from topleft to rightdown.
  • ImgScale: You can scale the image from 1 to 100.

How to use

You can choose two options: as other buttons, you can add the DLL in Class_RibbonRoundButton, or you can add an existing item in the Solution Explorer and choose RibbonRoundButton.cs, then recompile and add the button to the Form.

RibbonFastMenu 1.0

It's the form that appears when you click on the MenuButton on the top-left. This Form has the typical app options.

I have to implement a SetHSB() method to change the colors, but it is functional.

How to use

In a Windows application, choose Add Existing Item, and select the RibbonFastMenu.cs. I recommend adding all the existing resources from the RibbonTest app to have all the images, and then you will have a Form like in the first image of the article.

Comments

I'm designing a better way to use the RibbonContextMenu because I think it's a bit difficult to use, but please be patient till I finish it.

Keep in mind

  • I have to add the SetHSB() method to the FastMenu.
  • Make a better way to implement the FastMenu.
  • Make a stable version of the RibbonContextMenu.

History

  • June 2007 - RibbonForm 1.0, RibbonFastMenu 1.0, RibbonRoundButton 1.0.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

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
 
I'm developing with WPF4, SL4 MVVM, MVC3 Razor and WP7 projects, more info at my websites. Improving with Android and IOS.
 
Web:
Expediteapps


Take a look to my blog Juan Pablo G.C.
Mareinsula

Comments and Discussions

 
GeneralMy vote of 2 Pinprofessional i0024-Jun-14 1:47 
GeneralRe: My vote of 2 PinmemberJuan Pablo G.C.11-Jul-14 3:42 
SuggestionForm Resize/Positioning Fix (modification) PinmemberSomeguydude30-Jun-12 5:59 
GeneralTidy up the code == Fix CPU utilisation Pinmemberseeblunt1-Sep-09 13:53 
This is probably a good example of why not to use var and why you MUST dispose of graphics objects.
var confuses me! Not that I am stupid, just that explicit declaration allows easier reading the code and fixing BUGS.
 
Graphics objects are meant to be disposed.
When I sorted through the code of the RibbonButton and added using constructs, CPU utilisation which previously started at 0 but went to 12% after a mouseover was fixed so that it went back to zero and peaked at 3%.
(Rising sustained CPU utilisation is a hint that coding errors related to object disposing exist - Did not even need a profiler to guess this).
 
eg
private void FillStroke(Graphics gr, int stroke, Color incolor)
{
Rectangle re = new Rectangle(stroke, stroke, Width - 2*stroke - regionoffset, Height - 2*stroke - regionoffset);
using (SolidBrush brush = new SolidBrush(incolor))
{
gr.FillEllipse(brush, re);
}
}
 
private void DrawStroke(Graphics gr, int stroke, Color incolor)
{
Rectangle re = new Rectangle(stroke, stroke, Width - 3*stroke - regionoffset, Height - 3*stroke - regionoffset);
using (Pen pen = new Pen(incolor, stroke))
{
gr.DrawEllipse(pen, re);
}
}

GeneralCPU 100% Pinmembernaami_siq22-Nov-08 23:00 
GeneralRe: CPU 100% Pinmemberkapil bhavsar26-Jun-09 1:37 
GeneralCPU 100% Pinmembernaami_siq22-Nov-08 22:57 
GeneralA suggestion to improve the form Pinmemberjavar9-Sep-08 20:34 
GeneralFew problems in your implementation PinmemberHawVie15-Apr-08 0:06 
GeneralRe: Few problems in your implementation PinmemberMark Rice11-Aug-08 8:26 
GeneralGenerating code for alt colour PinmemberDerek Bartram29-Jan-08 20:20 
GeneralComments Pinmemberderek_bartram29-Jan-08 13:52 
GeneralFormBorder style PinmemberCrusty Applesniffer2-Jan-08 5:51 
GeneralBug in RibbonColor [modified] PinmemberThe_Mega_ZZTer17-Aug-07 8:19 
GeneralRe: Bug in RibbonColor Pinmemberflash.tato27-Dec-07 4:48 
General100% cpu power PinmemberRoey C4-Aug-07 7:19 
Questionhow would you do this with other components PinmemberMartyK20073-Aug-07 3:00 
NewsGreat job! But I have s small question: PinmemberLe.Wang1-Aug-07 3:01 
GeneralGREAT JOB! PinmemberSniper16720-Jul-07 10:33 
GeneralRe: GREAT JOB! PinmemberJuan Pablo G.C.21-Jul-07 22:54 
QuestionIs it just me or is this unusable right now? PinmembereeMarcoK28-Jun-07 21:18 
GeneralProblem in Resize with 2 monitors... PinmemberPakT25-Jun-07 6:08 
GeneralThanks! Pinmemberhoana200714-Jun-07 0:42 
GeneralDisposing of graphics objects Pinmemberrazzielx7-Jun-07 9:41 
GeneralGreat job Pinmemberraymond.chen20085-Jun-07 15:33 

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

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

| Advertise | Privacy | Mobile
Web02 | 2.8.140926.1 | Last Updated 3 Jun 2007
Article Copyright 2007 by Juan Pablo G.C.
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid