帮助,我无法将我的属性放入设计器 PropertyGrid 中

发布于 2024-11-06 10:49:32 字数 966 浏览 1 评论 0原文

这有什么问题吗?属性 LeftImage 没有显示在 PropertyGrid (WinForms .NET 3.5) 中

    private Image _LeftImage;

    /// <summary>
    /// Sets the small image appearing to the left of the trackbar
    /// </summary>

    [
    Description("The small image appearing to the left of the trackbar"),
    Category("Appearance"),
    EditorAttribute(typeof(System.Drawing.Design.ImageEditor), typeof(System.Drawing.Design.UITypeEditor)),
    DefaultValueAttribute(typeof(Image),"null"),
    Browsable(true), EditorBrowsable(EditorBrowsableState.Always)
    ]

    public Image LeftImage
    {
        private get { return _LeftImage; }
        set
        {
            if (value.Height != 16 || value.Width != 16)
            {
                _LeftImage = new Bitmap(value,new Size(16,16));
            }
            else _LeftImage = value;
            Invalidate();
        }
    }

我哪里出错了??? IDE 不会抱怨任何事情,并且编译良好,并且所有其他属性都显示正常。有什么想法吗?

What is wrong with this? The property LeftImage doesn't show up in the PropertyGrid (WinForms .NET 3.5)

    private Image _LeftImage;

    /// <summary>
    /// Sets the small image appearing to the left of the trackbar
    /// </summary>

    [
    Description("The small image appearing to the left of the trackbar"),
    Category("Appearance"),
    EditorAttribute(typeof(System.Drawing.Design.ImageEditor), typeof(System.Drawing.Design.UITypeEditor)),
    DefaultValueAttribute(typeof(Image),"null"),
    Browsable(true), EditorBrowsable(EditorBrowsableState.Always)
    ]

    public Image LeftImage
    {
        private get { return _LeftImage; }
        set
        {
            if (value.Height != 16 || value.Width != 16)
            {
                _LeftImage = new Bitmap(value,new Size(16,16));
            }
            else _LeftImage = value;
            Invalidate();
        }
    }

Where do i go wrong??? The IDE doesn't complain about anything, and it compiles fine, and all the other properties show up alright. Any thoughts?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

想你的星星会说话 2024-11-13 10:49:32

删除 LeftImage 的 get 语句上的私有访问器。将其更改为

get { return m_LeftImage; }

Remove the private accessor on get statement of LeftImage. Change it to

get { return m_LeftImage; }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文