Export (0) Print
Expand All

FontFamily.GetCellAscent Method

Returns the cell ascent, in design units, of the FontFamily of the specified style.

Namespace: System.Drawing
Assembly: System.Drawing (in system.drawing.dll)

public int GetCellAscent (
	FontStyle style
)
public int GetCellAscent (
	FontStyle style
)
public function GetCellAscent (
	style : FontStyle
) : int
Not applicable.

Parameters

style

A FontStyle that contains style information for the font.

Return Value

The cell ascent for this FontFamily that uses the specified FontStyle.

The following code example is designed for use with Windows Forms, and it requires PaintEventArgse, which is a parameter of the Paint event handler. The code performs the following actions:

  • Creates a FontFamily.

  • Gets the cell ascent for that font family.

  • Draws the value of the cell ascent to the screen as text.

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));
}

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.get_Graphics().DrawString("ascentFontFamily.GetCellAscent() returns "
        + System.Convert.ToString(cellAscent) + ".", 
        new Font(ascentFontFamily, 16), 
        Brushes.get_Black(), new PointF(0, 0));
} //GetCellAscent_Example

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft