all groups > dotnet windows forms > march 2008 >
You're in the

dotnet windows forms

group:

const Image to set DefaultValue on Image property



const Image to set DefaultValue on Image property CBanu [IXIA]
3/26/2008 5:42:35 AM
dotnet windows forms: Hi all,

I'm having some problems with one of my controls. I derived a control
(MyImageButton) only to set a specific Image on it
(MyToolTipInfoButton) when calling the constructor. However, the
designer doesn't know about this change, because on the Image property
the DefaultValueAttribute is still null. When trying to override it, I
see that I can only use const values when creating the attribute.

The question is: how do I create a const Image? I know how to do
static, but const is a mistery.

I hope someone has a solution for this.

Thanks in advance,
Re: const Image to set DefaultValue on Image property CBanu [IXIA]
3/26/2008 7:46:29 AM
After searching a little more, I found the following article "Defining
Default Values with the ShouldSerialize and Reset Methods":

http://msdn2.microsoft.com/en-us/library/53b8022e(VS.80).aspx

Now all I need to do is to somehow remove the DefaultValueAttribute
from the Image property. Any ideas on this one?

Thanks,
Cosmin

[quoted text, click to view]
AddThis Social Bookmark Button