about inherits custom control

G

Guest

hi all
i am trying to make a custom control in specify a button with an image
so i have googled around finding the good article on MSDN where it is
explain how to make a control which behaves like a button
(http://msdn2.microsoft.com/en-us/library/aa446518.aspx)..
this custom controls inherits from Control
and override the onPaint methods...this is good but this is quite more like
an image that you can click..

iìd like to have a button with an image over it but with the shape of the
button..so i have changed the code inheriting from Button...
but in this way i can see that the onPaint event never fires..so the code
which calls the drawing logic never executes

i hope i am clear
 
F

Fabien

Hi,

In your OnPaint overrited method, did you call the OnPaint method of
your mother class ?

protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
// Your code
}

BR

Fabien Decret
Windows Embedded Consultant

ADENEO (ADESET)
http://www.adeneo.adetelgroup.com/
 
G

Guest

yes i call it, and as a matter of fact if i inherits from the generic class
Control all work, only if i inherits from the class Button the event doesn't
fire...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top