I'm using C# windows forms control library program to create my own control, the code as follow:
public partial class MyControl : UserControl
{
public MyControl()
{
InitializeComponent();
}
private float mMinValue;
[Browsable(true)]
[EditorBrowsable(EditorBrowsableState.Always)]
[Category("Design") , DefaultValue(0.0)]
public float MinValue
{
get { return mMinValue; }
set { mMinValue = value; }
}
private float mMaxValue;
[Browsable(true)]
[EditorBrowsable(EditorBrowsableState.Always)]
[Category("Design") , DefaultValue(1.0)]
public float MaxValue
{
get { return mMaxValue; }
set { mMaxValue = value; }
}
}
When the program runs, the default value of MinValue and MaxValue are both 0, so how to set the default value correctly?