FontStyle Énumération
Définition
Spécifie les informations de style appliquées au texte.Specifies style information applied to text.
Cette énumération a un attribut FlagsAttribute qui permet une combinaison au niveau du bit de ses valeurs membres.
public enum class FontStyle
[System.Flags]
public enum FontStyle
[<System.Flags>]
type FontStyle =
Public Enum FontStyle
- Héritage
- Attributs
Champs
Bold | 1 | Texte gras.Bold text. |
Italic | 2 | Texte italique.Italic text. |
Regular | 0 | Texte normal.Normal text. |
Strikeout | 8 | Texte barré d'une ligne à mi-hauteur.Text with a line through the middle. |
Underline | 4 | Texte souligné.Underlined text. |
Exemples
L’exemple de code suivant montre comment affecter à la Font propriété d’un bouton une nouvelle police de style gras à l’aide de l' FontStyle énumération.The following code example demonstrates how to set the Font property of a button to a new bold-style font using the FontStyle enumeration. Cet exemple est conçu pour être utilisé avec Windows Forms.This example is designed to be used with Windows Forms. Créez un formulaire contenant un bouton nommé Button1 et collez-y le code suivant.Create a form containing a button named Button1 and paste the following code into it. Associez la Button1_Click
méthode à l’événement du bouton Click .Associate the Button1_Click
method with the button's Click event.
private:
void Button1_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ )
{
Button1->Font = gcnew System::Drawing::Font( FontFamily::GenericSansSerif,12.0F,FontStyle::Bold );
}
private void Button1_Click(System.Object sender, System.EventArgs e)
{
if (Button1.Font.Style != FontStyle.Bold)
Button1.Font = new Font(FontFamily.GenericSansSerif,
12.0F, FontStyle.Bold);
}
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
If Not Button1.Font.Style = FontStyle.Bold Then
Button1.Font = New Font(FontFamily.GenericSansSerif, _
12.0F, FontStyle.Bold)
End If
End Sub