帮助,我无法将属性添加到设计器PropertyGrid中

编程入门 行业动态 更新时间:2024-10-22 02:46:17
本文介绍了帮助,我无法将属性添加到设计器PropertyGrid中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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

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(); } }

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

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?

推荐答案

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

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

get { return m_LeftImage; }

更多推荐

帮助,我无法将属性添加到设计器PropertyGrid中

本文发布于:2023-11-06 13:44:46,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1563856.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:属性   PropertyGrid

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!