My problem is not to assign a value to this property. I think it it how
to clear it, if user press DELETE, BACKSPACE keys when this property has
the focus in the property editor.
For example if i assign a bitmap to form thanks backgroundimage
property, just by pressing delete, this property is cleared.
i would like to have the same for my property..
that's all
Al.
Well why don't you try the "DefaultValueAttribute" as I told you?
I think it's exactky what you need!
Anyway, FYI, here is what reflector says about Control.BackgroundImage:
[System::ComponentModel::DefaultValue(*static_cast<__box
System::String*>(0)), System::ComponentModel::Localizable(true),
System::Windows::Forms::SRDescription(S"ControlBackgroundImageDescr"),
System::Windows::Forms::SRCategory(S"CatAppearance")]
public: __property virtual System::Drawing::Image __gc*
get_BackgroundImage()
{
return *static_cast<__box
System::Drawing::Image*>(this->Properties->GetObject(System::Windows::Forms::Control::PropBackgroundImage));
}public: __property virtual void __gc*
set_BackgroundImage(System::Drawing::Image __gc* value)
{
if (this->BackgroundImage != value)
{
this->Properties->SetObject(System::Windows::Forms::Control::PropBackgroundImage,
value);
this->OnBackgroundImageChanged(System::EventArgs::Empty);
}
}
> My problem is not to assign a value to this property. I think it it how to
> clear it, if user press DELETE, BACKSPACE keys when this property has the
[quoted text clipped - 64 lines]
>>>>
>>>> -cd
--== Alain ==-- - 26 Oct 2006 19:44 GMT
i tried but it does not work as expected :-(
when i see the code you wrote, it seems that an event is also added.
is it like that for all properties ? because i've not seen it till now.
moreover, where did you find the code below ? in help ?
i did not find it..
thx.
Al.
> Well why don't you try the "DefaultValueAttribute" as I told you?
> I think it's exactky what you need!
[quoted text clipped - 88 lines]
>>>>>
>>>>> -cd
Lloyd Dupont - 27 Oct 2006 01:43 GMT
Google: Must have .NET developer tools
=> http://msdn.microsoft.com/msdnmag/issues/04/07/MustHaveTools/
Google: Reflector .NET
=> http://www.aisto.com/roeder/dotnet/
Reflector is the tool which will give you the source code from an MSIL.
>i tried but it does not work as expected :-(
> when i see the code you wrote, it seems that an event is also added.
[quoted text clipped - 103 lines]
>>>>>>
>>>>>> -cd
--== Alain ==-- - 27 Oct 2006 07:38 GMT
Thanks for information but after your previous post, i got it ;-)
however, i would like to understand something.
It seems that everything is written with CLI managed v1, while i use v2.
therefore, as i do not want to use v1, i do not have /clr:OldSyntax as
compiler option.
I tried to migrate the code from v1 to v2 of CLI managed, but without
success. I still have the same issue. I can not clear my property field
value by pressing DELETE or BACKSPACE keys.
Something must be wrong in my code :-( or i miss the point...
Al.
> Google: Must have .NET developer tools
> => http://msdn.microsoft.com/msdnmag/issues/04/07/MustHaveTools/
[quoted text clipped - 111 lines]
>>>>>>>
>>>>>>> -cd
Lloyd Dupont - 28 Oct 2006 00:20 GMT
Do not worry about the syntax!
It might very well have been written in C# to start with, it's just
reflector which decompile in old MC++ syntax!
Glad you solved your problem.
> Thanks for information but after your previous post, i got it ;-)
>
[quoted text clipped - 127 lines]
>>>>>>>>
>>>>>>>> -cd
--== Alain ==-- - 27 Oct 2006 19:32 GMT
I've found where was the problem... at least :-)
i should cast my default value to String as follow :
System::ComponentModel::DefaultValueAttribute(static_cast
<System::String^> (nullptr))]
and not to an image^ ... like that it allow DELETE and BACKSPACE keys to
be used.
thx a lot Lloyd !
Alain
> Google: Must have .NET developer tools
> => http://msdn.microsoft.com/msdnmag/issues/04/07/MustHaveTools/
[quoted text clipped - 111 lines]
>>>>>>>
>>>>>>> -cd