Control.DefaultFont Eigenschap
Definitie
Belangrijk
Bepaalde informatie heeft betrekking op een voorlopige productversie die aanzienlijk kan worden gewijzigd voordat deze wordt uitgebracht. Microsoft biedt geen enkele expliciete of impliciete garanties met betrekking tot de informatie die hier wordt verstrekt.
Hiermee haalt u het standaardlettertype van het besturingselement op.
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
Waarde van eigenschap
De standaardwaarde Font van het besturingselement. De geretourneerde waarde is afhankelijk van het besturingssysteem van de gebruiker, afhankelijk van de lokale cultuurinstelling van het systeem.
Uitzonderingen
Het standaardlettertype of de regionale alternatieve lettertypen zijn niet geïnstalleerd op de clientcomputer.
Voorbeelden
In het volgende codevoorbeeld ziet u hoe u de DefaultBackColor, DefaultFonten DefaultForeColor leden gebruikt. Als u het voorbeeld wilt uitvoeren, plakt u de volgende code in een formulier met de ListBox naam ListBox1. Roep de Populate_ListBox methode aan in de constructor- of Load gebeurtenisafhandelingsmethode van het formulier.
// 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
Opmerkingen
In de volgende tabel wordt de waarde beschreven die wordt DefaultFont geretourneerd door afhankelijk van het besturingssysteem en de lokale cultuur.
| Systeem/en cultuur | lettertype |
|---|---|
| Windows NT 4x, Japanse versie | MS UI Gothic, 9 punt. |
| Arabische Windows | Tahoma, 8 punt. |
| Ander besturingssysteem/cultuur | Logisch lettertype ms Shell Dlg, meestal Microsoft San Serif 8 punt. |
MS Shell Dlg wordt toegewezen aan een lettertypeset in het systeemregister.
Als de vorige lettertypen niet zijn geïnstalleerd, is het standaardlettertype Tahoma, 8 punten. Als Tahoma, 8 punt, niet is geïnstalleerd, DefaultFont retourneert u de waarde van de GenericSansSerif eigenschap