Font size, name and strike out : Font « 2D Graphics « C# / C Sharp

Home
C# / C Sharp
1.2D Graphics
2.Class Interface
3.Collections Data Structure
4.Components
5.Data Types
6.Database ADO.net
7.Design Patterns
8.Development Class
9.Event
10.File Stream
11.Generics
12.GUI Windows Form
13.Language Basics
14.LINQ
15.Network
16.Office
17.Reflection
18.Regular Expressions
19.Security
20.Services Event
21.Thread
22.Web Services
23.Windows
24.Windows Presentation Foundation
25.XML
26.XML LINQ
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source
C# / C Sharp » 2D Graphics » FontScreenshots 
Font size, name and strike out
Font size, name and strike out

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

   public class UsingFonts : System.Windows.Forms.Form
   {
      private System.ComponentModel.Container components = null;

      public UsingFonts()
      {
         InitializeComponent();
      }
      private void InitializeComponent()
      {
         this.AutoScaleBaseSize = new System.Drawing.Size(513);
         this.ClientSize = new System.Drawing.Size(504109);
         this.Name = "UsingFonts";
         this.Text = "UsingFonts";

      }
      static void Main() 
      {
         Application.Runnew UsingFonts() );
      }

      protected override void OnPaint(PaintEventArgs paintEvent )
      {
         Graphics graphicsObject = paintEvent.Graphics;
         SolidBrush brush = new SolidBrushColor.DarkBlue );

         // arial, 12 pt bold
         FontStyle style = FontStyle.Bold;
         Font arial = new Fontnew FontFamily"Arial" )12, style );

         // times new roman, 12 pt regular
         style = FontStyle.Regular;
         Font timesNewRoman = new Font"Times New Roman"12, style );

         // courier new, 16 pt bold and italic
         style = FontStyle.Bold | FontStyle.Italic;
         Font courierNew = new Font"Courier New"16, style );

         // tahoma, 18 pt strikeout
         style = FontStyle.Strikeout;
         Font tahoma = new Font"Tahoma"18, style );

         graphicsObject.DrawStringarial.Name + 
            " 12 point bold.", arial, brush, 1010 );

         graphicsObject.DrawStringtimesNewRoman.Name + 
            " 12 point plain.", timesNewRoman, brush, 1030 );

         graphicsObject.DrawStringcourierNew.Name + 
            " 16 point bold and italic.", courierNew, 
            brush, 1054 );

         graphicsObject.DrawStringtahoma.Name +
            " 18 point strikeout.", tahoma, brush, 1075 );

      
   





           
       
Related examples in the same category
1.Draw font cell ascent, cell descent, line space, em height
2.Get font family infoGet font family info
3.Get font from Font dialog and redraw stringGet font from Font dialog and redraw string
4.Font AttributesFont Attributes
5.Fonts ClassFonts Class
6.Font Metrics
7.Font ViewerFont Viewer
8.Smoothing FontsSmoothing Fonts
9.Font FamyliesFont Famylies
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.