Home  >  Article  >  Backend Development  >  Print using your own fonts using C#

Print using your own fonts using C#

WBOY
WBOYforward
2023-09-15 12:29:091040browse

使用 C# 使用您自己的字体进行打印

To print your own font in C#, first construct -

  • FontFamily object
  • Font object

FontFamily object sets fonts such as Arial, TimesNewRoman, etc., while the Font object sets the size and style of the font.

Let's create an Arial font style.

FontFamily myFontFamily = new FontFamily("Arial");
Font myFont = new Font(
myFontFamily,
20,
FontStyle.Bold,
GraphicsUnit.Pixel);

Above, we set up the FontFamily object. The first argument passed to Font() is the FontFamily object "myFontFamily", followed by the size of the font. The third parameter sets the style.

The above is the detailed content of Print using your own fonts using C#. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete