Modifying the Label Property(text and font) by a custom ComboBox
Posted
by BDotA
on Stack Overflow
See other posts from Stack Overflow
or by BDotA
Published on 2010-05-25T21:11:50Z
Indexed on
2010/05/25
21:21 UTC
Read the original article
Hit count: 140
c#
|custom-controls
I have created a custom combobox that has a LABEL property so when we drop it on a form, we can say the Label associated with this ComboBox is say Label2 this is what I wrote for its label property. The whole thing I want to do is that when I am assigning the Label property of my custom ComboBox to one of the labels on the form, I want that label to change its font to bold and also add an "*" to its Test property. thats it ... but it does not work! any ideas?
private Label assignedLabelName;
public Label AssignedLabelName
{
get
{
return assignedLabelName;
}
set
{
assignedLabelName = value;
assignedLabelName.Text = "*" + assignedLabelName.Text;
assignedLabelName.Font = new Font(AssignedLabelName.Font, FontStyle.Bold);
}
}
© Stack Overflow or respective owner