【问题标题】:Unhiding wanted properties in custom controls在自定义控件中取消隐藏想要的属性
【发布时间】:2016-05-11 18:00:10
【问题描述】:

我的问题与Hiding unwanted properties in custom controls 基本相反。

根据我找到的描述 here at SO: 3529928/how-do-i-put-text-on-progressbar,我创建了自己的带有文本支持的 ProgressBar。它真的很棒。我稍微修改了它以供我使用:我不使用该示例的新属性CustomText,我使用Controls 基类的内置Text

ProgressBar 默认情况下对Text 没有用处,因此它隐藏在设计器中。我怎样才能取消隐藏它?

我试图重载它以应用[Browsable(true)] 属性,但它还不起作用:

[Browsable (true)]
virtual property String^    Text      { String^ get()             override;
                                        void    set(String^ text) override; };

我还需要做什么?

【问题讨论】:

    标签: c# properties c++-cli controls windows-forms-designer


    【解决方案1】:

    删除 Visual Studio 2008 中的临时文件后
    C:\Users\...\AppData\Local\Microsoft\VisualStudio\9.0\ProjectAssemblies\
    并删除 .suo 和 .ncb,
    并重新启动 VS2008,
    ...
    属性变得可见。所以这是设计师更新失败,但代码有效。 :-)

    【讨论】:

      猜你喜欢
      • 2010-12-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-01-14
      • 2017-05-14
      • 1970-01-01
      • 1970-01-01
      • 2011-12-31
      相关资源
      最近更新 更多