本文整理汇总了C#中System.Drawing.FontFamily.GetCellAscent方法的典型用法代码示例。如果您正苦于以下问题:C# FontFamily.GetCellAscent方法的具体用法?C# FontFamily.GetCellAscent怎么用?C# FontFamily.GetCellAscent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Drawing.FontFamily
的用法示例。
在下文中一共展示了FontFamily.GetCellAscent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetCellAscent_Example
public void GetCellAscent_Example(PaintEventArgs e)
{
// Create a FontFamily object.
FontFamily ascentFontFamily = new FontFamily("arial");
// Get the cell ascent of the font family in design units.
int cellAscent = ascentFontFamily.GetCellAscent(FontStyle.Regular);
// Draw the result as a string to the screen.
e.Graphics.DrawString(
"ascentFontFamily.GetCellAscent() returns " + cellAscent.ToString() + ".",
new Font(ascentFontFamily, 16),
Brushes.Black,
new PointF(0, 0));
}
示例2: Main
//引入命名空间
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
public class Test{
static void Main() {
FontFamily myFamily = new FontFamily("Verdana");
Font myFont = new Font(myFamily, 12);
int fontHeight = myFont.Height;
Console.WriteLine("Measurements are in GraphicsUnit." + myFont.Unit.ToString());
Console.WriteLine("The Verdana family.");
// Print our Family ties...
Console.WriteLine("Ascent for bold Verdana: " + myFamily.GetCellAscent(FontStyle.Bold));
Console.WriteLine("Descent for bold Verdana: " + myFamily.GetCellDescent(FontStyle.Bold));
Console.WriteLine("Line spacing for bold Verdana: " + myFamily.GetLineSpacing(FontStyle.Bold));
Console.WriteLine("Height for bold Verdana: " + myFamily.GetEmHeight(FontStyle.Bold));
}
}