Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Hide BorderStyle
Message
De
05/10/2009 12:41:59
 
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01427185
Message ID:
01427763
Vues:
38
>Ok, I added this property to my class, except I made it private, and I can still see and set the property in the prop sheet.

OK, a couple of things ...

1) It needs to be public, not private ... the "new" means that it's "hiding" the public BorderStyle property in the base Windows.Forms UserControl. By making it private you're not "hiding" the public property.

2) This will not prevent the property from showing up in the Property Sheet for the user control class you've created, but it will prevent it from showing in any sub-class of your user control. You could always make your user control class abstract so that it always needs to be sub-classed.

~~Bonnie





>>>I'm creating a user control. Is it possible to hide the control's BorderStyle property?
>>
>>Kevin, you need to use the [Browsable(false)] attribute. The BorderStyle property is not virtual however, so you'll need to specify it like this:
>>
>>
>>[Browsable(false)]
>>public new BorderStyle BorderStyle
>>{
>>	get { return base.BorderStyle; }
>>	set { base.BorderStyle = value; }
>>}
>>
>>
>>~~Bonnie
>
>
>Ok, I added this property to my class, except I made it private, and I can still see and set the property in the prop sheet.
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