Click here to Skip to main content
Licence 
First Posted 22 Dec 2003
Views 66,628
Bookmarked 32 times

Rainbow Button

By | 22 Dec 2003 | Article
Making a rainbow colored button using a custom control

Introduction

This is my first article and am sorry for any mistakes ;-)

The control is a rainbow coloured button. It has all the features of a normal button, it is also fully customizable with your own colours. I would like to quickly thank Alexandr Khilov for his superb article on the cuteButton.

Background

I was on the bus coming back from work with I saw a rainbow scarf and thought I'd make a rainbow button. Well enough of that lets get down to the code.

How to use the code

The rainbow button can be accessed from the System.Windows.Forms namespace. It has two constructors, one takes five colours and the other takes non. The later assigns default colours to the button. You are able to change the colours with an immediate effect on the button.

private System.Windows.Forms.rainbowButton rainbowButton1;
rainbowButton1 = new System.Windows.Forms.rainbowButton (); <BR>    // with default colours
rainbowButton1 = new System.Widows.Forms.rainbowButton
    (Colors.Blue, Colors.Red, Colors.Pink, Colors.Aqua, Colors.Green);<BR>     // with 5 user defined colours        

When a colour is changed the ColorChanged event is raised to use at your disposal. The rainbow button has the workings of any other button, so all normal event are available.

Finishing up

For a complete look at the control, have a peek at the code and mess about with it. If their is any problems with the control please email me. Enjoy the control.

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

About the Author

David Preece



United Kingdom United Kingdom

Member

David lives in London, UK.
 
Programming history includes, C/C++, C#, PHP, JavaScript and other web related languages.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralSweet PinmemberShin-Ra12:12 3 Apr '07  
GeneralCould u Xplain Me Pinmemberajith_9822:43 15 Oct '05  

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.

Permalink | Advertise | Privacy | Mobile
Web03 | 2.5.120517.1 | Last Updated 23 Dec 2003
Article Copyright 2003 by David Preece
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid