FontFamily.GetName(Int32) Método
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Devolve o nome, na linguagem especificada, deste FontFamily.
public:
System::String ^ GetName(int language);
public string GetName(int language);
member this.GetName : int -> string
Public Function GetName (language As Integer) As String
Parâmetros
- language
- Int32
A língua em que o nome é devolvido.
Devoluções
A String que representa o nome, na língua especificada, deste FontFamily.
Exemplos
O seguinte exemplo de código foi concebido para uso com Windows Forms e requer PaintEventArgse, que é um parâmetro do tratador de eventos Paint. O código executa as seguintes ações:
Cria um FontFamily.
Recebe o nome da família de fontes.
Desenha o nome da família de fontes no ecrã como texto.
public:
void GetName_Example( PaintEventArgs^ e )
{
// Create a FontFamily object.
FontFamily^ myFontFamily = gcnew FontFamily( "Arial" );
// Get the name of myFontFamily.
String^ familyName = myFontFamily->GetName( 0 );
// Draw the name of the myFontFamily to the screen as a string.
e->Graphics->DrawString( String::Format( "The family name is {0}", familyName ),
gcnew System::Drawing::Font( myFontFamily,16 ), Brushes::Black, PointF(0,0) );
}
public void GetName_Example(PaintEventArgs e)
{
// Create a FontFamily object.
FontFamily myFontFamily = new FontFamily("Arial");
// Get the name of myFontFamily.
string familyName = myFontFamily.GetName(0);
// Draw the name of the myFontFamily to the screen as a string.
e.Graphics.DrawString(
"The family name is " + familyName,
new Font(myFontFamily, 16),
Brushes.Black,
new PointF(0, 0));
}
Public Sub GetName_Example(ByVal e As PaintEventArgs)
' Create a FontFamily object.
Dim myFontFamily As New FontFamily("Arial")
' Get the name of myFontFamily.
Dim familyName As String = myFontFamily.GetName(0)
' Draw the name of the myFontFamily to the screen as a string.
e.Graphics.DrawString("The family name is " & familyName, _
New Font(myFontFamily, 16), Brushes.Black, New PointF(0, 0))
End Sub
Observações
Para indicar neutralidade linguística, deve especificar 0 para o language parâmetro. Para uma lista das línguas e sublinguagens disponíveis, consulte o ficheiro de cabeçalho Winnt.h. Se tiver o Visual Studio instalado, este ficheiro de cabeçalho pode normalmente ser encontrado relativamente ao diretório de instalação do Visual Studio em \\VC\PlatformSDK\Include.