Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Clear type font usage in C#/VB.NET

How do I use a ClearType font in C#/VB.NET?

like image 759
SamSol Avatar asked May 28 '10 12:05

SamSol


People also ask

What is ClearType font?

ClearType is a software technology developed by Microsoft that improves the readability of text on existing LCDs (Liquid Crystal Displays), such as laptop screens, Pocket PC screens, and flat panel monitors.

How do I enable ClearType in Windows 11?

Turn on ClearTypePress the Windows + Q key on the keyboard. In the Search box type ClearType. In the search results list, click Adjust ClearType text (Control panel). Check Turn on ClearType, and click Next.


1 Answers

protected override void OnPaint(PaintEventArgs e)
{
    e.Graphics.DrawString("Normal style", this.Font, Brushes.Black, 50, 50);

    e.Graphics.TextRenderingHint =
         System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;

    e.Graphics.DrawString("ClearType style", this.Font, Brushes.Black, 50, 100);
}
like image 137
Laplace Avatar answered Sep 25 '22 14:09

Laplace