Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Managed C++/CLI
  4. How to use PropertyGrid to browse and modify the attributes of customized object

How to use PropertyGrid to browse and modify the attributes of customized object

Scheduled Pinned Locked Moved Managed C++/CLI
tutorialquestion
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    akira32
    wrote on last edited by
    #1

    I define a class MyObject. I want to use PropertyGrid to browse and modify the attributes of myObject (MyObject object). Can I reach this goal? If the answer is "Yes". Could sombody tell me how to do? ref class MyObject { public: int x; int y; int rx; int ry; }; private: System::Void FormProperty_Load(System::Object^ sender, System::EventArgs^ e) { MyObject^ myObject=gcnew MyObject(); propertyGrid1->SelectedObject = myObject; }

    A 1 Reply Last reply
    0
    • A akira32

      I define a class MyObject. I want to use PropertyGrid to browse and modify the attributes of myObject (MyObject object). Can I reach this goal? If the answer is "Yes". Could sombody tell me how to do? ref class MyObject { public: int x; int y; int rx; int ry; }; private: System::Void FormProperty_Load(System::Object^ sender, System::EventArgs^ e) { MyObject^ myObject=gcnew MyObject(); propertyGrid1->SelectedObject = myObject; }

      A Offline
      A Offline
      akira32
      wrote on last edited by
      #2

      I had used public property to solve this problem. But... I meet another problem. If SelectedObject is a nested object like basicobject, how to show the parameters of basiceffect in PropertyGrid? public ref class BasicEffect { public: BasicEffect(void) { } virtual ~BasicEffect() { } public: [Browsable(true)] property System::Boolean loop { bool get() { return _loop; } void set(System::Boolean value) { _loop=value; } } private: System::Boolean _loop; }; public ref class UIObject { public: UIObject(void){_basiceffect=gcnew BasicEffect()}; virtual ~UIObject(void){}; public: [Browsable(true)] property int x { int get() { return _x; } void set(int value) { _x=value; } } public: [Browsable(true)] property BasicEffect^ basiceffect2 { BasicEffect^ get() { return _basiceffect2; } void set(BasicEffect^ value) { _basiceffect2=value; } } private: int _x; private: BasicEffect^ _basiceffect2; };

      modified on Thursday, November 19, 2009 3:32 AM

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups