I got the value to show up correctly using:
[DefaultValue ( typeof ( Color ), "255, 0, 0" )]
public Color LineColor
{
get { return lineColor; }
set { lineColor = value; Invalidate ( ); }
}
But after I reload the project the control is used, this value is set to White, which I can invoke Reset to get back to Red again, but I don't understand the problem.
How are you supposed to set the default value and make sure it's preserved unless I change the value manually from the default?
Actually I am also doing this, which sets Back and ForeColor to these values and the VS property editor shows them as if they are changed from the default value.
Is this wrong?
public CoolGroupBox ( )
{
InitializeComponent ( );
base.BackColor = Color.FromArgb ( 5, 5, 5 );
base.ForeColor = Color.FromArgb ( 0, 0, 0 );
}
The trick is to use the Hex code of the color:
[DefaultValue(typeof(Color), "0xFF0000")]
public Color LineColor
{
get { return lineColor; }
set { lineColor = value; Invalidate ( ); }
}
I think you can also use "255, 0, 0" but am not sure and have normally used either the named colors or the hex code.