Label Font.Size
I am placing a label onto a form programically...
Label objId;
objId =
new Label();objId.BackColor = Color.Transparent;
objId.ForeColor = Color.Blue;
// objId.Font.Size = 22; //Read Only?
objId.Text = "TEST";
pictureBox1.Controls.Add(objId);
I can't seem to find the right way to simply change the font size.
Thanks,
Zath
[588 byte] By [
Zath] at [2007-12-18]
You cannot change just the font size, instead you need give it a new Font instance, and to maintain any additional Font information from the previous instance you'd want to use the previous instance to create the new one ala:
objId.Font = new Font(objId.Font.FontFamily, newFontSize, objId.Font.Style);
where newFontSize is the size you want for the new font.