There are two specified methods for the default value of the component properties:
First, describe the characteristics of the attribute
For example, as follows, a class of properties
Public Class Myclass
{
Private int myproperty;
[DefaultValue (3)]]
Public int myProperty
{
Get {return myproperty;}
set
{
IF (MyProperty! = Value)
MyProperty = VALUE;
}
}
....
}
More common features Description is the definition of [DefaultValue (typeof (
[DefaultValue (TypeOf (Color), "White")] and
[DefaultValue (TypeOf (Point), "{x = 110, y = 120}")], etc. ...
Second, use the ShouldSerialIze
The particularity of this method is that the method's naming has an agreement, and the naming must be started at the ShouldSerialize, and then the return type must be a BOOL type. The method implementation to define this property and the default value of the default value, if the designer is called this After the method, Returns true, which is displayed at the bold, which is usually used for some of the complex class properties, such as font, or custom types. In addition, the generally excellent design also implements the Reset
For the characteristics of component properties, please see the "RAD component written with .NET property window interact"
http://blog.9cbs.net/zoulNG/Archive/2005/03/23/328215.aspx