How to change font, size and style of a label programatically

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to change a lables font at runtime.

When I sent the labels font to New Font ("Andy",16,2) it wont allow be to
set the style(2)
If I remove the style it errors because the font does not support the style
regular.

This has to be easy....What am I doing wrong?

Thanks
 
Hello,
I think you want to do this:
label1.Font = new System.Drawing.Font("Arial",16.0f, (FontStyle)2);

HTH. Cheers :)
Maqsood Ahmed [MCP C#,SQL Server]
Kolachi Advanced Technologies
http://www.kolachi.net
 
Maqsood Ahmed said:
I think you want to do this:
label1.Font = new System.Drawing.Font("Arial",16.0f, (FontStyle)2);

'(FontStyle)2' => 'FontStyle.Italic'.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top