Jump to content
  • Advertisement
Sign in to follow this  
romainechester

Customized buttons on C#

This topic is 5064 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Um... I was wondering how to make customized buttons in C#. Lets say I want to make a round button. How do I do that? I'm not that much good of a programmer so it would be great if anyone could show even a short code or part of code that shows how to.

Share this post


Link to post
Share on other sites
Advertisement
What you're looking for is called "owner drawing." You basically override the default paint commands for a control and provide your own.

The best resource I could point you to would be the RegionMaster controls on WindowsForms.net. They include the source code and are fairly well documented so with a little time and effort you'll be up and running.

G'luck.

Share this post


Link to post
Share on other sites
For nonstandard or weird-shaped buttons, you have to draw them yourself. Check out the helpfiles on the OwnerDraw property.

The simple (but cruder and less efficient) way is to put a transparent PictureBox on your form with the image of the button you want. Then override the mouse events to make the "button" respond appropriately (changing color when the mouse is hovering, becoming depressed when you click it, etc.).

Share this post


Link to post
Share on other sites
Quote:
The best resource I could point you to would be the RegionMaster controls on WindowsForms.net. They include the source code and are fairly well documented so with a little time and effort you'll be up and running.


Waaahhhh!!! I can't understand a single line of code!! And also my version of VS .NET is much older and I can't open the solution file.

Isn't there another much more "simpler" way of doing it?

Share this post


Link to post
Share on other sites
The simplest way I know of is the one I mentioned, I'm afraid. Owner-drawing isn't easy, but it's not too hard either. Take some time to read up on it (CodeGuru will have some articles, most likely), or try posting over on the msdn message boards.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!