:
public void button_click(object sender, EventArgs e)
{
var select= font1.SelectedItem.Value;
if(select=="Bold")
{
// I have the following methods of doing this; None works for me.
label1.Style["Font-Weight"]="bold";
//I also tried this:
label1.Font = new Font(label1.Font, FontStyle.Bold);
//and this:
this.label1.Font= new Font(this.label1.Font, FontStyle.Bold);
}
}
When using .Font I get errors for invalid arguments, that the arguments for Font must be like this: Font(string, float). Also, keep in mind that the method of putting the actual size in the argument list is not what i want to do. Like thislabel1.Font=new Font("Arial", 16, FontStyle.Bold);
//I don't want to change the font family or sixe of the label's text
No comments:
Post a Comment