FontFamily.GetLineSpacing(FontStyle) Método
Definição
Retorna o espaçamento entre linhas, em unidades de design, do FontFamily do estilo especificado.Returns the line spacing, in design units, of the FontFamily of the specified style. O espaçamento entre linhas é a distância vertical entre as linhas base de duas linhas consecutivas de texto.The line spacing is the vertical distance between the base lines of two consecutive lines of text.
public:
int GetLineSpacing(System::Drawing::FontStyle style);
public int GetLineSpacing (System.Drawing.FontStyle style);
member this.GetLineSpacing : System.Drawing.FontStyle -> int
Public Function GetLineSpacing (style As FontStyle) As Integer
Parâmetros
Retornos
A distância entre duas linhas consecutivas de texto.The distance between two consecutive lines of text.
Exemplos
O exemplo de código a seguir foi projetado para uso com Windows Forms, e ele requer PaintEventArgs e , que é um parâmetro do Paint manipulador de eventos.The following code example is designed for use with Windows Forms, and it requires PaintEventArgse, which is a parameter of the Paint event handler. O código executa as seguintes ações:The code performs the following actions:
Cria um FontFamily.Creates a FontFamily.
Obtém o espaçamento de linha para a família de fontes.Gets the line spacing for the font family.
Desenha o valor do espaçamento de linha para a tela como texto.Draws the value of the line spacing to the screen as text.
public:
void GetLineSpacing_Example( PaintEventArgs^ e )
{
// Create a FontFamily object.
FontFamily^ myFontFamily = gcnew FontFamily( "Arial" );
// Get the line spacing for myFontFamily.
int lineSpacing = myFontFamily->GetLineSpacing( FontStyle::Regular );
// Draw the value of lineSpacing to the screen as a string.
e->Graphics->DrawString( String::Format( "lineSpacing = {0}", lineSpacing ),
gcnew System::Drawing::Font( myFontFamily,16 ), Brushes::Black, PointF(0,0) );
}
public void GetLineSpacing_Example(PaintEventArgs e)
{
// Create a FontFamily object.
FontFamily myFontFamily = new FontFamily("Arial");
// Get the line spacing for myFontFamily.
int lineSpacing = myFontFamily.GetLineSpacing(FontStyle.Regular);
// Draw the value of lineSpacing to the screen as a string.
e.Graphics.DrawString(
"lineSpacing = " + lineSpacing.ToString(),
new Font(myFontFamily, 16),
Brushes.Black,
new PointF(0, 0));
}
Public Sub GetLineSpacing_Example(ByVal e As PaintEventArgs)
' Create a FontFamily object.
Dim myFontFamily As New FontFamily("Arial")
' Get the line spacing for myFontFamily.
Dim lineSpacing As Integer = _
myFontFamily.GetLineSpacing(FontStyle.Regular)
' Draw the value of lineSpacing to the screen as a string.
e.Graphics.DrawString("lineSpacing = " & lineSpacing.ToString(), _
New Font(myFontFamily, 16), Brushes.Black, New PointF(0, 0))
End Sub