Control.DefaultFont Propriedade
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.
Fica com a fonte padrão do controlo.
public:
static property System::Drawing::Font ^ DefaultFont { System::Drawing::Font ^ get(); };
public static System.Drawing.Font DefaultFont { get; }
static member DefaultFont : System.Drawing.Font
Public Shared ReadOnly Property DefaultFont As Font
Valor de Propriedade
O padrão Font do controlo. O valor devolvido variará consoante o sistema operativo do utilizador, a definição de cultura local do seu sistema.
Exceções
A fonte padrão ou as fontes alternativas regionais não estão instaladas no computador cliente.
Exemplos
O seguinte exemplo de código demonstra como usar os DefaultBackColorelementos, DefaultFont, e DefaultForeColor os membros. Para executar o exemplo, cole o código seguinte numa forma contendo um ListBox chamado ListBox1. Chame o Populate_ListBox método no construtor do formulário ou Load no método de gestão de eventos.
// The following method displays the default font,
// background color and foreground color values for the ListBox
// control. The values are displayed in the ListBox, itself.
void Populate_ListBox()
{
ListBox1->Dock = DockStyle::Bottom;
// Display the values in the read-only properties
// DefaultBackColor, DefaultFont, DefaultForecolor.
ListBox1->Items->Add( String::Format( "Default BackColor: {0}", ListBox::DefaultBackColor ) );
ListBox1->Items->Add( String::Format( "Default Font: {0}", ListBox::DefaultFont ) );
ListBox1->Items->Add( String::Format( "Default ForeColor:{0}", ListBox::DefaultForeColor ) );
}
// The following method displays the default font,
// background color and foreground color values for the ListBox
// control. The values are displayed in the ListBox, itself.
private void Populate_ListBox()
{
ListBox1.Dock = DockStyle.Bottom;
// Display the values in the read-only properties
// DefaultBackColor, DefaultFont, DefaultForecolor.
ListBox1.Items.Add("Default BackColor: " +
ListBox.DefaultBackColor.ToString());
ListBox1.Items.Add("Default Font: " +
ListBox.DefaultFont.ToString());
ListBox1.Items.Add("Default ForeColor:" +
ListBox.DefaultForeColor.ToString());
}
' The following method displays the default font,
' background color and foreground color values for the ListBox
' control. The values are displayed in the ListBox, itself.
Private Sub Populate_ListBox()
ListBox1.Dock = DockStyle.Bottom
' Display the values in the read-only properties
' DefaultBackColor, DefaultFont, DefaultForecolor.
ListBox1.Items.Add("Default BackColor: " & ListBox.DefaultBackColor.ToString)
ListBox1.Items.Add("Default Font: " & ListBox.DefaultFont.ToString)
ListBox1.Items.Add("Default ForeColor:" & ListBox.DefaultForeColor.ToString)
End Sub
Observações
A tabela seguinte descreve o valor devolvido dependendo DefaultFont do sistema operativo e da cultura local.
| Sistema/ou Cultura | Tipo de letra |
|---|---|
| Windows NT 4x, versão japonesa | MS UI Gothic, 9 pontos. |
| Windows árabe | Tahoma, 8 pontos. |
| Outro sistema operativo/cultura | Fonte lógica MS Shell DLG, tipicamente Microsoft San Serif de 8 pontos. |
O MS Shell Dlg mapeia para um conjunto de fontes no registo do sistema.
Se as fontes anteriores não estiverem instaladas, a fonte padrão é Tahoma, 8 pontos. Se Tahoma, 8 pontos, não estiver instalado, devolve DefaultFont o valor da GenericSansSerif propriedade