Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Subclassing a subclass
Message
De
07/10/2007 19:51:11
 
 
À
07/10/2007 19:27:05
Alan Harris-Reid
Baseline Data Services
Devon, Royaume Uni
Information générale
Forum:
ASP.NET
Catégorie:
Conception classe
Divers
Thread ID:
01256172
Message ID:
01259310
Vues:
15
It may be a tad more complicated, but it's really easy once you understand it ... it's really no big deal.

Yes, the DefaultValue attribute goes just before the properrty ... how else will the compiler know which property you are referring to? <g>

~~Bonnie



>Hi Bonnie,
>
>>
>>public class MyTextBox : System.Windows.Forms.TextBox
>>{
>>	public MyTextBox()
>>	{
>>		this.BackColor = Color.Firebrick; ;
>>	}
>>	[DefaultValue(typeof(System.Drawing.Color), "Firebrick")]
>>	public override System.Drawing.Color BackColor
>>	{
>>		get { return base.BackColor; }
>>		set { base.BackColor= value; }
>>	}
>>}
>>
>
>This gets more complicated by the minute! It's at times like these that I can't help thinking of how simple it was to achieve the same thing in VFP. The thing I find most frustrating is that you have to declare the default color twice, once in the constructor, and once as a default value (to please the designer). Still, that's progress I suppose :-(
>
>Must the DefaultValue directive always occur just before the override method for the corresponding property?
>
>TIA
>Alan
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform