Text Rendering Hint: ClearTypeGridFit : Text Rendering « 2D Graphics « C# / C Sharp






Text Rendering Hint: ClearTypeGridFit

Text Rendering Hint: ClearTypeGridFit

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Text;
public class Form1 : Form
{
  public Form1() {
        InitializeComponent();
        
  }
    private void SmoothingText_Paint(object sender, PaintEventArgs e)
    {
      Font TextFont = new Font("Times New Roman", 25, FontStyle.Italic);
      e.Graphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
      e.Graphics.DrawString("www.java2s.com", TextFont, Brushes.Black, 20, 20);

    }
    private void InitializeComponent()
    {
      this.SuspendLayout();
      // 
      // SmoothingText
      // 
      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
      this.ClientSize = new System.Drawing.Size(472, 315);
      this.Name = "SmoothingText";
      this.Text = "SmoothingText";
      this.Paint += new System.Windows.Forms.PaintEventHandler(this.SmoothingText_Paint);
      this.ResumeLayout(false);

    }

  [STAThread]
  static void Main()
  {
    Application.EnableVisualStyles();
    Application.Run(new Form1());
  }

}


           
       








Related examples in the same category

1.Hotkey Prefix
2.Use TexturedBrush to draw stringUse TexturedBrush to draw string
3.Text Rendering Hint: SingleBitPerPixelGridFitText Rendering Hint: SingleBitPerPixelGridFit
4.Text Rendering Hint: AntiAliasGridFitText Rendering Hint: AntiAliasGridFit
5.TextRenderingHint: Anti-Aliased Text
6.DrawString with solid brush, string format
7.DrawString with solid brush and rectangle
8.Draw string with hatch brush