Hi J,
I performed a test on this issue and did see the problem. The following is
the code of my custom control.
class MyControl:Control
{
[DefaultValue((string)null)]
public Image MyImage
{
get{return this.BackgroundImage;}
set { this.BackgroundImage = value; }
}
}
Build the project and add a MyControl on the form. I can delete the image
and set it back to "None" by pressing the Del key in the BackgroundImage
property entry within the Properties window. However, I can't do it in the
MyImage property grid entry.
I use Reflector and see that the BackgroundImage property of the Control
class has a DefaultValueAttribute with the value of (string)null.
I modify my test code as follows:
using System.ComponentModel;
class MyControl:Control
{
[DefaultValue((string)null)]
public Image MyImage
{
get{return this.BackgroundImage;}
set { this.BackgroundImage = value; }
}
}
Build the project and try again. I could now delete the image and set it to
"None" in the MyImage property grid entry by pressing the Del key.
Please try my suggestion and let me know the result.
Sincerely,
Linda Liu
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.