Customized buttons on C#
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.
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.
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.
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.).
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.).
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?
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement