Using an alternate class derived from

  • Thread starter Thread starter Carlos Lozano
  • Start date Start date
C

Carlos Lozano

Hello,

I have a class CustomButton that derives from
System.Windows.Forms.Control to create a button showing a
picture.
I would like it to behave as a real button derived from
System.Windows.Forms.Button in specific situations. Of
course keeping the custom methods and properties defined
in CustomButton. The only thing that changes is that it
derives from Button instead of Control.

Can the derived from class be dynamically specified
depending on conditions?

Thank you,

Carlos Lozano
www.caxonline.net
 
Carlos Lozano said:
Hello,

I have a class CustomButton that derives from
System.Windows.Forms.Control to create a button showing a
picture.
I would like it to behave as a real button derived from
System.Windows.Forms.Button in specific situations. Of
course keeping the custom methods and properties defined
in CustomButton. The only thing that changes is that it
derives from Button instead of Control.

Can the derived from class be dynamically specified
depending on conditions?

No, but IIRC, button derives from control, so you've no reason not to derive
from button.
 
Back
Top