FontFamily.GetCellAscent(FontStyle) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
返回指定样式的 FontFamily 的单元格上升,采用设计单位。
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
参数
返回
使用了指定的 FontStyle 的此 FontFamily 的单元格上升。
示例
下面的代码示例旨在与 Windows 窗体 一起使用,它需要 PaintEventArgse
,它是 事件处理程序的Paint一个参数。 此代码执行以下操作:
创建一个 FontFamily。
获取该字体系列的单元格升起。
以文本形式绘制单元格上升到屏幕的值。
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
适用于
另请参阅
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈