new Font("Times New Roman", 10, FontStyle.Italic) : Font : GUI Windows Form C# Source Code


Custom Search

C# Source Code » GUI Windows Form » Font »

 

new Font("Times New Roman", 10, FontStyle.Italic)








    
 



using System;
using System.Drawing;
using System.Windows.Forms;
   
class HowdyWorld: Form
{
     public static void Main()
     {
          Application.Run(new HowdyWorld());
     }
     public HowdyWorld()
     {
          ResizeRedraw = true; 
          MinimumSize = SystemInformation.MinimumWindowSize + new Size(0,1);
          
     }
     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)
     {
          Font  font   = new Font("Times New Roman", 10, FontStyle.Italic);
          SizeF sizef  = grfx.MeasureString(Text, font);
          float fScale = Math.Min(cx / sizef.Width, cy / sizef.Height);
   
          grfx.DrawString(Text, font, new SolidBrush(clr), 
                          (cx  - sizef.Width ) / 2, (cy - sizef.Height) / 2);
     }
}

 
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo GUI Windows Form
» Font