I have already introduced the role of TypeConverterAttribute metadata in the previous article, this article will show you the concrete implementation through the code. In this case, I'm going to add a complex attribute to the control that has no function for the control, purely for demonstration purposes, and somewhat far-fetched.
Now add a scope property to the control code that you created in the previous article:
[Browsable (True)]
Public scope scope
{
get
{return
_scope;
}
set
{
_scope = value;
}
}
The type of this property is the scope class, and the code is as follows:
public class Scope
{
private Int32 _min;
Private Int32 _max;
Public scope ()
{
} public
scope (Int32 min, Int32 max)
{
_min = min ;
_max = max;
[Browsable (true)] public
Int32 Min
{get
{
return _min;
}
set
{
_min = value;
}
[Browsable (true)] public
Int32 Max
{
get {return
_max;
}
set
{
_max = value;
}
}