PC Review


Reply
Thread Tools Rate Thread

about inherits custom control

 
 
=?Utf-8?B?YnVsZQ==?=
Guest
Posts: n/a
 
      6th Mar 2007
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
 
 
 
 
Fabien
Guest
Posts: n/a
 
      6th Mar 2007
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
 
=?Utf-8?B?YnVsZQ==?=
Guest
Posts: n/a
 
      6th Mar 2007
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
a custom control in VB.NET that inherits from TextBox and from IPostBackDataHandler.... z f Microsoft ASP .NET 1 1st Mar 2006 02:31 PM
putting custom control on a form that inherits from my form class, doesn't work Capital O Microsoft Dot NET Compact Framework 2 4th Jan 2006 06:36 PM
How to highlight text in a custom control that inherits from the control class? news.austin.rr.com Microsoft Dot NET Compact Framework 0 1st Mar 2005 07:37 PM
Inherits from Control, Yay, Inherits from WebControl, Nay.... Alex Nitulescu Microsoft ASP .NET 0 22nd Feb 2005 06:55 AM
Inherits a User Control Norton Microsoft VB .NET 1 21st Sep 2004 09:15 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:34 PM.