FontFamily.GetCellAscent(FontStyle) Metoda
Definice
Důležité
Některé informace platí pro předběžně vydaný produkt, který se může zásadně změnit, než ho výrobce nebo autor vydá. Microsoft neposkytuje žádné záruky, výslovné ani předpokládané, týkající se zde uváděných informací.
Vrátí výstup buňky v jednotkách návrhu FontFamily zadaného stylu.
public:
int GetCellAscent(System::Drawing::FontStyle style);
public int GetCellAscent (System.Drawing.FontStyle style);
member this.GetCellAscent : System.Drawing.FontStyle -> int
Public Function GetCellAscent (style As FontStyle) As Integer
Parametry
Návraty
Výstup buňky pro tento FontFamily objekt, který používá zadanou FontStylehodnotu .
Příklady
Následující příklad kódu je navržený pro použití s model Windows Forms a vyžaduje PaintEventArgse
, což je parametr obslužné rutiny Paint události. Kód provede následující akce:
Vytvoří .FontFamily
Získá výstup buňky pro danou rodinu písem.
Nakreslí hodnotu výstupu buňky na obrazovku jako text.
public:
void GetCellAscent_Example( PaintEventArgs^ e )
{
// Create a FontFamily object.
FontFamily^ ascentFontFamily = gcnew 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( String::Format( "ascentFontFamily.GetCellAscent() returns {0}.", cellAscent ),
gcnew System::Drawing::Font( ascentFontFamily,16 ), Brushes::Black, 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.Graphics.DrawString(
"ascentFontFamily.GetCellAscent() returns " + cellAscent.ToString() + ".",
new Font(ascentFontFamily, 16),
Brushes.Black,
new PointF(0, 0));
}
Public Sub GetCellAscent_Example(ByVal e As PaintEventArgs)
' Create a FontFamily object.
Dim ascentFontFamily As New FontFamily("arial")
' Get the cell ascent of the font family in design units.
Dim cellAscent As Integer = _
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))
End Sub
Platí pro
Viz také
Váš názor
https://aka.ms/ContentUserFeedback.
Připravujeme: V průběhu roku 2024 budeme postupně vyřazovat problémy z GitHub coby mechanismus zpětné vazby pro obsah a nahrazovat ho novým systémem zpětné vazby. Další informace naleznete v tématu:Odeslat a zobrazit názory pro