Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How does Visual Inheritance work in .Net?
Message
De
18/06/2007 16:24:02
 
 
À
18/06/2007 16:17:01
Calvin Smith
Wayne Reaves Computer Systems
Macon, Georgie, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
C# 2.0
OS:
Windows XP SP2
Divers
Thread ID:
01234107
Message ID:
01234110
Vues:
14
Hi, Calvin

The reason for this, is that when you drop subclassed controls onto a form, the Winform designer will generate code in the form for some of the standard display properties (like font). So if you go back and change the subclass, it won't be reflected on the form, because the Winform designer already generated the code.

I wrote an article in CoDe Magazine on this....I covered this on the fifth page...

http://www.code-magazine.com/article.aspx?quickid=0703092&page=5


Essentialy, in the subclass, you can't just simply set the font property. You have to do something a bit more elaborate...
override public Font Font
{
   get { return base.Font; }
   set { base.Font = value; }
}

public MyLabelClass()
{
     base.Font = new  Font("Verdana",8);
}
Hope that helps...
Kevin
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform