PC Review Forums Newsgroups Microsoft DotNet Microsoft Dot NET Compact Framework about inherits custom control

Reply

about inherits custom control

 
Thread Tools Rate Thread
Old 06-03-2007, 02:28 PM   #1
=?Utf-8?B?YnVsZQ==?=
Guest
 
Posts: n/a
Default about inherits custom control


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
  Reply With Quote
Old 06-03-2007, 04:09 PM   #2
Fabien
Guest
 
Posts: n/a
Default Re: about inherits custom control

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/




On 6 mar, 15:28, bule <b...@discussions.microsoft.com> wrote:
> 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



  Reply With Quote
Old 06-03-2007, 04:34 PM   #3
=?Utf-8?B?YnVsZQ==?=
Guest
 
Posts: n/a
Default Re: about inherits custom control

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...

"Fabien" wrote:

> 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/
>
>
>
>
> On 6 mar, 15:28, bule <b...@discussions.microsoft.com> wrote:
> > 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

>
>
>

  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off