P
PeterB
Hello everyone!
I am creating a custom label that could be used in VS design time. I am
inheriting from Control and do all of my drawing myself. I can add a label
to a design form in VS, resize it, change colors (back and fore), change the
font and of course the text. It all looks fine on the VS IDE design form.
The problem is that the code, that reflect the color/font changes, is not
applied to the InitializeComponent method, so if if I close VS and open it
again, the label is reset to it's original color/font values.
Any help here would be greatly appreciated!
/ Peter
Some more info:
I am overriding ForeColor and BackColor
In my control I use the following members to save the color information:
private Color m_backColor = Color.White; //Color.Empty;
private Color m_foreColor = Color.Black;
I then have 2 overridden properties (1 shown)
/// <summary>
/// Gets or sets the background color for the control.
/// </summary>
#if DESIGN
[
Category("Appearance"),
Description("The background color used to display text in the SIB control.")
]
#endif
public override Color BackColor
{
get
{
if ((m_backColor == Color.Empty) && (this.Parent != null))
{
return Parent.BackColor;
}
return m_backColor;
}
set
{
m_backColor = value;
this.Invalidate();
}
}
I am creating a custom label that could be used in VS design time. I am
inheriting from Control and do all of my drawing myself. I can add a label
to a design form in VS, resize it, change colors (back and fore), change the
font and of course the text. It all looks fine on the VS IDE design form.
The problem is that the code, that reflect the color/font changes, is not
applied to the InitializeComponent method, so if if I close VS and open it
again, the label is reset to it's original color/font values.
Any help here would be greatly appreciated!
/ Peter
Some more info:
I am overriding ForeColor and BackColor
In my control I use the following members to save the color information:
private Color m_backColor = Color.White; //Color.Empty;
private Color m_foreColor = Color.Black;
I then have 2 overridden properties (1 shown)
/// <summary>
/// Gets or sets the background color for the control.
/// </summary>
#if DESIGN
[
Category("Appearance"),
Description("The background color used to display text in the SIB control.")
]
#endif
public override Color BackColor
{
get
{
if ((m_backColor == Color.Empty) && (this.Parent != null))
{
return Parent.BackColor;
}
return m_backColor;
}
set
{
m_backColor = value;
this.Invalidate();
}
}