我有一个用户控件,其中包含以下代码。
[System.ComponentModel.Category("Appearance")] public override string Text { ... } private int myVar; [System.ComponentModel.Category("Appearance")] public int MyProperty { ... }
MyProperty 在窗体中插入控件时显示在属性网格中,但 Text 没有。我怎样才能看到它?
MyProperty
Text
如果将System.ComponentModel.Browsable(true)属性添加到属性中,它将显示在属性浏览器中。通过上面的例子,我确认了VS2008中的行为。