Windows Develop Bookmark and Share   
 index > Windows Forms General > A few questions about ExpandableObjectConverter and PropertyGrid
 

A few questions about ExpandableObjectConverter and PropertyGrid

Hi,

I'm currently playing with property grid, and I have the following piece of code :

[TypeConverterAttribute(ExpandableObjectConverter::typeid)]
public ref struct CVector3
{
	CVector3(void)
	{
		x = 0.1f;
		y = 0.2f;
		z = 0.3f;
	}

	property float x;
	property float y;
	property float z;

	virtual String ^ ToString(void) override
	{
		return(L"" + x + L"; " + y + L"; " + z);
	}
};

public ref class CDefaultNodeOptions : public System::Object
{
	public:
		CDefaultNodeOptions()
		{
			customVector3Property = gcnew CVector3;
		}
	
		~CDefaultNodeOptions()	{ }

	public:
		property bool boolProperty;
		property int intProperty;
		property float floatProperty;
		property Point pointProperty;

		property CVector3 ^ customVector3Property;
};

I've set the SelectedObject of my propertyGrid to a CDefaultNodeOptions, and I works fine. But when I expande the customVector3Property, and edit one of the x, y or z property, I need to collapse it to update the displayed value.

Do I need to capture and event when I change x, y or z to update the value of customVector3Property ? If so, how I do this ?

The second question now : I'm trying to find a good place with informations on propertygrids, and how to modify them.

For example, I'd like to have a custom property of type int, but which is modified via a slider bar. I already found a tutorial to do that, but it display the slider in a dropdown. I'd like the slider to be always displayed on the right part of the property.

I've foundsome articles onGetPaintValueSupported() and PaintValue(). But I don't really know how to use those to display a slider (I can use them to draw rectangles, and stuff, but I can't get ride of the rectangle outline, and I can't place what I want to draw on the right of the value. Nor can I draw a slider.)

Well, that's all for now ^^

If you know a good place to learn how to customize propertyGrids and displayed element, or if you have an answer to my questions ... thx in advance ^^

Paic Citron  Thursday, March 09, 2006 10:33 AM
bump.
Sorry to bother, but I really would like to know more about the propertyGrid control.
Paic Citron  Friday, March 10, 2006 8:16 AM

You can use google to search for other answers

Custom Search

More Threads

• My UserControls and ToolTips
• [VB.NET] Complex search between two table with relation bound to two datagridview, need some suggestion.
• Wrong key after deletion
• How to add controls dynamically depending of the type of an enum? Which Design Pattern...?
• general purpose button event handler to navigate to windows form,
• textbox values
• ANSI for encoding
• How to write the text of the TextBlock to a ASCII plaintext file.
• How to get the pixels per inch when printing?
• Visual Studio 2005 Compiler