Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How does Visual Inheritance work in .Net?
Message
De
20/06/2007 15:06:02
 
 
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:
01234563
Vues:
9
Martin:

Does this work with inheritance, as well? In other words, if you create a base label class with Font = Arial 8pt, then subclass it without touching the Font properties, drop your subclassed labels to a bunch of forms, then decide that Arial 8pt looks hideous and change the base label class' font to Times Roman pt 20 (beautiful!), does the message "change label fonts to Times Roman pt 20) go to all of the projects with all of the forms that use the subclassed labels, so that they, too, will look that much prettier without any additional programmer intervention?

I know this works with a lot of PEMs, I'm just curious about Fonts as an example, since they seem to be a stumbling block for the person who started this whole thread. And if it doesn't happen with Fonts, is there a list of "non-inheriting" PEMs somewheres within easy reach?

Thanks!


Pertti



>Hi, Pertti
>>
>>Thank you for your response -- since you have clearly worked with .NET a lot more than I have, you have a much better understanding of it (warts and all), I'm sure.
>
>Yes, I've been working with it for many years and I know a lot of dirty stuff, but plenty of good stuff, too.
>
>To make the point clear: .NET handles OOP almost by the book (more than that would be Smalltalk, but I'll get back later to this). Here is an really simple example:
>
>
>public class BigLabel : Label {
>   public BigLabel() {
>      Font = new Font("Verdana", 24);
>   }
>}
>
>
>Drop this into a Winform and you have a big label as you might expect.
>
>That being said, when you try to do this over the designers things may vary. A lot of people are better at Winforms than me (Bonnie been the Almighty Wizard). I try to avoid doing UI stuff as much as I can, except now with WPF, which is just great. Wit the designers, you can get some weird things going on that resemble the same that happens to you if you do that in VFP:
>
>1 - create a label subclass - FontName = Courier
>2 - drop an instance on a form
>3 - change the FontName to Arial, then back to Courier, but manually, not with "reset to default"
>4 - go change the subclass label to Font = Times Roman (ugh)
>5 - go back to the form - hey! it didn't change! 8-)
>
>Yes, with the designer this can be trickier, but not soooo much, really.
>
>Now, back to Smalltalk (a topic I DO like), you may take a look at:
>http://vistascript.net/
>
>Smalltalk running on Silverlight, yeah!!!
>
>Regards,
Pertti Karjalainen
Product Manager
Northern Lights Software
Fairfax, CA USA
www.northernlightssoftware.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform