简体   繁体   中英

How can I get an overridden Text property of my user control to show up in the form designer in VS2005?

I have a user control with the following code in it.

[System.ComponentModel.Category("Appearance")]
public override string Text { ... }

private int myVar;
[System.ComponentModel.Category("Appearance")]
public int MyProperty { ... }

MyProperty shows up in the property grid when the control is inserted in a form, but Text does not. How can I get it visible?

If you add the System.ComponentModel.Browsable(true) attribute to your property it should show up in the property browser. Using your example above I confirmed the behavior in VS2008.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM