Windows Develop Bookmark and Share   
 index > Windows Forms General > redrawing buttons?
 

redrawing buttons?

HY,

I'm interested in How can I iherit and redraw a controll > button, textbox, toolstrip menu etc. I have been searching for tutorials and documentation and I haven't found anything yet.
I'm trying (for example) to make a hexagonal button.> to redraw it (not to draw one whith the gdi....i know how to do that)....I whant to inherit it from vb and redraw it...
How hard is this?
Are there any tutorials?
Have you done this before?

Please help me. I am searching for a while and can't find anything.
                                    
                                                                                                Cypry


Cypry  Saturday, December 03, 2005 8:43 AM
Hi,

First of all, questions like these who are related to Windows Form best be asked in the Windows Forms General forum.
Second, there's actually tons of information on GUI customization. For instance, look at
www.thecodeproject.com
www.codeguru.com
http://www.geekswithblogs.net/kobush/articles/CustomBorderForms.aspx

Of course, the Windows General forums and the WindowsForm & Drawing newsgroups can also help out a lot.

As a beginner, you may first start out checking these pages:

http://msdn.microsoft.com/smartclient/community/wffaq/default.aspx
http://www.bobpowell.net/


I cannot give you a full course on customizing controls here. But let me give you a few tips:
-If you want non-rectangular buttons really to respond only to mouse clicks that are actually on the shape of your control, set the Region object on your control. This object can be constructed from a GraphicsPath.
-You can derive from Control or from Button and override OnPaint. I found that overriding Button doesn't really add a whole lot to deriving from Control, since you will have to implement the logic for the clicking etc all yourself (internal state not really exposed).
-To support Accept/Cancel button on form, derive and implement from IButtonControl

Gotta go now, hope this helps.

Jelle van der Beek
Jelle van der Beek2  Sunday, December 04, 2005 8:03 AM
Ok...i'll be more precise:
I know that visual basic offers the possibility to "work" with the properties of buttons, menus, forms...
What I whant to do is,<an example> shape  a button how I whant..Make the button round, or like a star, a 3D star....anithing I whant....using ineritance...
Or a menu....I whant to use the GDI and properties of a menu and redraw it in order to make a figure that I want.
All I know is that you haveto inherit the controll(button) .......something like this:

Inherits System.Windows.Forms.Button

and afther that...0...nothing....nimic(romanian :) ).
This is a very usefull thing ....you won't haveto draw something from 0 with GDI+. You just Inherit  it from Visual Basic and you modify it. If you know\heard\find anything about this...please tell me....
   
Thank you :)
                                                                                                 Cypry 
                           


Cypry  Saturday, December 03, 2005 11:57 PM
Hi,

First of all, questions like these who are related to Windows Form best be asked in the Windows Forms General forum.
Second, there's actually tons of information on GUI customization. For instance, look at
www.thecodeproject.com
www.codeguru.com
http://www.geekswithblogs.net/kobush/articles/CustomBorderForms.aspx

Of course, the Windows General forums and the WindowsForm & Drawing newsgroups can also help out a lot.

As a beginner, you may first start out checking these pages:

http://msdn.microsoft.com/smartclient/community/wffaq/default.aspx
http://www.bobpowell.net/


I cannot give you a full course on customizing controls here. But let me give you a few tips:
-If you want non-rectangular buttons really to respond only to mouse clicks that are actually on the shape of your control, set the Region object on your control. This object can be constructed from a GraphicsPath.
-You can derive from Control or from Button and override OnPaint. I found that overriding Button doesn't really add a whole lot to deriving from Control, since you will have to implement the logic for the clicking etc all yourself (internal state not really exposed).
-To support Accept/Cancel button on form, derive and implement from IButtonControl

Gotta go now, hope this helps.

Jelle van der Beek
Jelle van der Beek2  Sunday, December 04, 2005 8:03 AM
Thank's for the answers. I will post this message in the Windows Forms (maibe I'll get even more answers :) and the post will be helpfull to other people ;) ).
Cypry  Sunday, December 04, 2005 8:59 AM
Yes, as an advice: please read the Windows Forms FAQ first, and then try to post very specific questions on what you're trying to accomplish.

I'll be happy to answer more of your questions.
Jelle van der Beek2  Sunday, December 04, 2005 10:40 AM

You can use google to search for other answers

Custom Search

More Threads

• Webbrowser Control and New Windows
• Find Dialog Source Code Help? -Word Processing with an Extended Rich Text Box Control -
• Encounter "Window handle already exists" exception when hide a tooltip
• EnumChildWindows and modal dialogs
• Delete Key does not respond smart client app
• Switching between Console application and Windows Forms applications
• ToolStrip scrolling with keyboard displays non available items.
• How Can I display a trnslated column in a Datagridview?
• DataGridView and swopping between EditModes
• Problem in Web-browser SaveAs