new Font(strFont, fSize) : Font « GUI Windows Form « C# / C Sharp






new Font(strFont, fSize)

 


using System;
using System.Drawing;
using System.Windows.Forms;
   
class FontSizes: Form
{
     public static void Main()
     {
          Application.Run(new FontSizes());
     }
     public FontSizes()
     {
          Text = "Font Sizes";
          ResizeRedraw = true; 
     }
     protected override void OnPaint(PaintEventArgs pea)
     {
          DoPage(pea.Graphics, ForeColor,ClientSize.Width, ClientSize.Height);
     }
     
     protected void DoPage(Graphics grfx, Color clr, int cx, int cy)
     {    
          string strFont = "Times New Roman";
          Brush  brush   = new SolidBrush(clr);
          float  y       = 0;
   
          for (float fSize = 6; fSize <= 12; fSize += 0.25f)
          {
               Font font = new Font(strFont, fSize);
               grfx.DrawString(strFont + " in " + fSize + " points", 
                               font, brush, 0, y);

          }
     }
}

 








Related examples in the same category

1.All font properties
2.new Font("Times New Roman", 10, FontStyle.Italic)
3.new Font(fontRegular, FontStyle.Italic);
4.Text on Baseline
5.Font: SizeInPoints
6.Font with different size
7.Font: GetHeight
8.System Fonts: Icon Title FontSystem Fonts: Icon Title Font
9.Load all system installed fontsLoad all system installed fonts
10.Timer based animation for fontTimer based animation for font
11.Get all system installed fontGet all system installed font
12.Font listFont list