2

我有一个用户控件,其中包含以下代码。

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

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

MyProperty将控件插入表单时显示在属性网格中,但Text不显示。我怎样才能让它可见?

4

1 回答 1

6

如果您将 System.ComponentModel.Browsable(true) 属性添加到您的属性,它应该会显示在属性浏览器中。使用上面的示例,我确认了 VS2008 中的行为。

于 2009-02-18T17:51:21.570 回答