propertygrid utilization

B

Bernie Yaeger

How can I set the browsableattributes of the control that has been selected
(selectedobject) by the propertygrid?

Here's what I'm after - I want to open a form with a propertygrid in it.
The selectedobject will be the form itself. I want the user to change
certain properties, thus changing the form. This works fine, but what I
really want is to take the changes and lock them into a config file, such
that this pc will then display all forms with these attributes.

I don't want the user to be able to change everything - for example, I don't
want a standard form size, nor a standard cursor, but I do want the user to
be able to select the font, font size, form backcolor, etc. So I have to be
able to include only certain properties in the propertygrid. Then of course
I need to trap the selected values and lock them into global variables, them
rebuild the config file to reflect this (when the use selects and 'update'
button).

Thanks for any help with all of this.

Bernie Yaeger
 
C

Cor

Hi Bernie,

I think you are on the border where to take the registry or a config.file.

Where you are talking about are runtime properties, maybe you can save them
also at the end in your config. But I think this is real the registry.

The registry is very easy to use in VB.net

I would not take the registry property because you only want to change the
properties the user can use, you can that make as nice as you want using a
trackbar and things like that I think.

But I asume you know that already.

Cor
 
J

Jay B. Harlow [MVP - Outlook]

Bernie,
In addition to Cor's comments.

I don't have a specific example, have you considered using a proxy object?

Instead of passing the Form or Control itself to the PropertyGrid, pass your
own object to the PropertyGrid.

Your proxy object would need to implement the
System.ComponentModel.ICustomTypeDescriptor to limit the properties that are
displayed by the Property Grid. System.ComponentModel.TypeDescriptor has a
number of useful helper functions that your implementation of
ICustomTypeDescriptor could use.

For details on the property grid see:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/usingpropgrid.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/vsnetpropbrow.asp

Hope this helps
Jay
 
B

Bernie Yaeger

Hi Cor,

You are of course correct - the registry is where I intend to place these
settings.

Thanks for your help.

Bernie
 
B

Bernie Yaeger

Hi Jay,

The links you provided - especially the first - really get me going in the
right direction. He's doing almost exactly what I'm looking for.

Tx,

Bernie
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top