问题描述
我有一个.NET的PropertyGrid。我选择一个对象查看,而该对象的属性是一个Vector3类型。我可以用ExpandableObjectConverter自动将Vector3类型的属性暴露到PropertyGrid中。一切都很好,只是在选择的对象,我想的Vector3类型被缺省的扩展,即所以你可以看到X,Y和放大器; ž无需点击[+]。我怎样才能做到这一点?
//托管C ++:
[类型转换器(ExpandableObjectConverter :: typeid的)]
公共REF结构Vector3类型
{
Vector3类型(浮点_x,_y浮动,浮动_z)
:X(_x)
,Y(_y)
,Z(_z)
{}
浮动的x,y和z;
物业浮动X
{
浮动的get(){返回X; }
}
物业浮ÿ
{
浮动的get(){返回是; }
}
物业浮动ž
{
浮得到(){返回Z者除外; }
}
};
答案基本上是在这里提供:展开展出 C#的PropertyGrid
需要只有一些小的变化,找到specifc属性代替一个类别。
I have a .net PropertyGrid. I select an object to view, and a property of that object is a Vector3. I can use ExpandableObjectConverter to automatically expose the properties of the Vector3 into in the PropertyGrid. All fine, except that when the object is selected I'd like the Vector3 to be expanded by default, i.e. so you can see X, Y & Z without having to click [+]. How can I do this?
// Managed C++ :
[TypeConverter(ExpandableObjectConverter::typeid)]
public ref struct Vector3
{
Vector3(float _x, float _y, float _z)
: x(_x)
, y(_y)
, z(_z)
{}
float x, y, z;
property float X
{
float get() { return x; }
}
property float Y
{
float get() { return y; }
}
property float Z
{
float get() { return z; }
}
};
The answer is basically provided here:Expand C# propertygrid on show
Only some small changes are needed to find the specifc property instead of a category.
这篇关于我怎样才能展开ExpandableObjectConverter对象在PropertyGrid中自动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!