【发布时间】:2010-11-03 13:18:38
【问题描述】:
您好,这是我的第一个堆栈溢出问题,如果我做了任何愚蠢的事情,请原谅我。 好吧,我的问题是我正在使用关卡编辑器,我想使用 PropertyGrid 控件来编辑图块/实体等的属性。所以到目前为止一切正常,值显示正确,更改槽代码时更新,但问题我正在经历的是,除非它是布尔值,否则我无法更改值,我用谷歌搜索了很多,但我根本找不到解决方案。
这是我定义属性的代码:
[Description("Defines the Position on the screen")]
public Vector2 screenpos { get; set; }
Vector2 WorldPos;
[Description("Defines the texture of the selected tile")]
public string texture { get; set; }
[Description("Defines if the player can collide with this tile")]
public bool IsCollidable { get; set; }
[Description("Defines on what layer this tile is drawn (1-3)")]
public int Layer { get; set; }
[Description("Shows if the tile is currently visible on the screen")]
public bool OnScreen { get; private set; }
我可以编辑 IsCollidable,如果我从 OnScreen 的集合中删除私有,我也可以编辑它,但我不能编辑其他任何东西,哦,如果你能把你的答案说得简单一点,我会很高兴我没那么多一位经验丰富的程序员,在此先感谢。
【问题讨论】:
标签: c# winforms properties propertygrid