Files
docs-desktop/dotnet-desktop-guide/framework/winforms/advanced/using-fonts-and-text.md
T
Andy De George c0ba284473 Initial winforms content migrated (#18)
* Merge winforms framework content to working branch (#14)

* Breadcrumb / TOC / Move net5 to net folder (#15)

* change path from net5 to net

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Add .net 5 winforms placeholder article (#16)

* added some metadata and adjusted net5 placeholder

* corrections

* corrections

* corrections

* Test1

* Swapping landing page vs concept

* fix links

* Fix links

* Fix desc
2020-09-01 16:26:21 -07:00

3.3 KiB

title, ms.date, helpviewer_keywords, ms.assetid
title ms.date helpviewer_keywords ms.assetid
Using Fonts and Text 03/30/2017
GDI [Windows Forms], drawing text [Windows Forms]
text [Windows Forms], drawing in Windows Forms
examples [Windows Forms], fonts and text
fonts [Windows Forms], using in Windows Forms
strings [Windows Forms], drawing in Windows Forms
d43640f3-da94-4df2-a29d-a9d021a1c069

Using Fonts and Text

There are several classes offered by GDI+ and GDI for drawing text on Windows Forms. The GDI+ xref:System.Drawing.Graphics class has several xref:System.Drawing.Graphics.DrawString%2A methods that allow you to specify various features of text, such as location, bounding rectangle, font, and format. In addition, you can draw and measure text with GDI using the static xref:System.Windows.Forms.TextRenderer.DrawText%2A and xref:System.Windows.Forms.TextRenderer.MeasureText%2A methods offered by the TextRenderer class. The GDI methods also allow you to specify location, font, and format. You can choose either GDI or GDI+ for text rendering; however, GDI generally offers better performance and more accurate text measuring. Other classes that contribute to text rendering include FontFamily, Font, xref:System.Drawing.StringFormat, and TextFormatFlags.

In This Section

How to: Construct Font Families and Fonts
Shows how to create Font and FontFamily objects.

How to: Draw Text at a Specified Location
Describes how to draw text in a certain location using GDI+ and GDI.

How to: Draw Wrapped Text in a Rectangle
Explains how to draw text in a rectangle using GDI+ and GDI.

How to: Draw Text with GDI
Demonstrates how to use GDI for drawing text.

How to: Align Drawn Text
Shows how to format GDI+ and GDI text.

How to: Create Vertical Text
Describes how to draw vertically aligned text with GDI+.

How to: Set Tab Stops in Drawn Text
Shows how draw text with tab stops with GDI+.

How to: Enumerate Installed Fonts
Explains how to list the names of installed fonts.

How to: Create a Private Font Collection
Describes how to create a xref:System.Drawing.Text.PrivateFontCollection object.

How to: Obtain Font Metrics
Shows how to obtain font metrics such as cell ascent and descent.

How to: Use Antialiasing with Text
Explains how to use antialiasing when drawing text.

Reference

xref:System.Drawing.Font
Describes this class and contains links to all of its members.

xref:System.Drawing.FontFamily
Describes this class and contains links to all of its members.

xref:System.Drawing.Text.PrivateFontCollection
Describes this class and contains links to all of its members.

xref:System.Windows.Forms.TextRenderer
Describes this class and contains links to all of its members.

xref:System.Windows.Forms.TextFormatFlags
Describes this class and contains links to all of its members.