new Font(strFont, fSize) : Font : GUI Windows Form C# Source Code


Custom Search

C# Source Code » GUI Windows Form » Font »

 

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);

          }
     }
}

 
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo GUI Windows Form
» Font