Image Property on PropertyGrid


C

Chris Dunaway

I am using the PropertyGrid and I have set the SelectedObject property to
an instance of my custom class. One of the properties of the custom class
is a bitmap.

The PropertyGrid lets me assign a bitmap ok, but when I want to delete it,
I cannot do it.

For example, in Visual Studio when you set the background image for a form,
you can highlight it and press delete to clear the property. But for my
own class and the PropertyGrid, it won't do this.

Can anyone shed some light on how I might accomplish this? I tried
specifying the editor as the ImageEditor using the Editor Attribute on the
property, but that made no difference.

I just want the user to be able to selcect the image property in the
PropertyGrid and press delete to clear it.

Thanks

--
Chris

dunawayc[AT]sbcglobal_lunchmeat_[DOT]net

To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.
 
Ad

Advertisements

M

Mick Doherty

Add the defaultValue Attribute.

<DefaultValue(GetType(Image), Nothing)>

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html


Chris Dunaway said:
I am using the PropertyGrid and I have set the SelectedObject property to
an instance of my custom class. One of the properties of the custom class
is a bitmap.

The PropertyGrid lets me assign a bitmap ok, but when I want to delete it,
I cannot do it.

For example, in Visual Studio when you set the background image for a
form,
you can highlight it and press delete to clear the property. But for my
own class and the PropertyGrid, it won't do this.

Can anyone shed some light on how I might accomplish this? I tried
specifying the editor as the ImageEditor using the Editor Attribute on the
property, but that made no difference.

I just want the user to be able to selcect the image property in the
PropertyGrid and press delete to clear it.

Thanks

--
Chris

dunawayc[AT]sbcglobal_lunchmeat_[DOT]net

To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.
 
Ad

Advertisements

C

Chris Dunaway

<DefaultValue(GetType(Image), Nothing)>
Thanks, that did the trick!

--
Chris

dunawayc[AT]sbcglobal_lunchmeat_[DOT]net

To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.
 

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