Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
DefaultValue for Tab Control ItemSize
Message
De
11/10/2005 12:44:32
 
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01057791
Message ID:
01057989
Vues:
17
This message has been marked as the solution to the initial question of the thread.
Chris,

Sorry I should have explained a bit better. The code below is a test property I created that accesses a test field call _testSize inside the class.
private Size _testSize;

[DefaultValue(typeof(System.Drawing.Size), "100, 45")]
public Size TestSize
{
   get { return _testSize; }
   set
   {
      _testSize = value;
   }
}
If you look at the help for the DefaultValueAttribute class (attribute) and look at the available constructors you can see the following constructor signature.
public DefaultValueAttribute(
   Type type,
   string value
);
The string value must be compatible with your types TypeConverter, in this case:-
System.Drawing.SizeConverter
This allows you to reset complex types that the DefaultValueAttribute has no specific knowledge of.

Regards
Neil
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform