2010-11-03 37 views
4

我有一個.net PropertyGrid。我選擇一個要查看的對象,並且該對象的屬性是Vector3。我可以使用ExpandableObjectConverter自動將Property3中的Vector3的屬性公開到PropertyGrid中。一切都好,除了選擇對象時,我想默認擴展Vector3,也就是說,您不必單擊[+]即可看到X,Y & Z.我怎樣才能做到這一點?如何自動展開PropertyGrid中的ExpandableObjectConverter對象?

// 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; } 
    } 
}; 
+0

請參閱下面的答案。它能爲您提供幫助嗎?如果是這樣,請接受我的回答(也可以自由投票;) – Peladao 2011-01-28 15:37:59

回答