FontDialog.ShowColor Propriété

Définition

Obtient ou définit une valeur indiquant si la boîte de dialogue propose un choix de couleurs.

public:
 property bool ShowColor { bool get(); void set(bool value); };
public bool ShowColor { get; set; }
member this.ShowColor : bool with get, set
Public Property ShowColor As Boolean

Valeur de propriété

Boolean

true lorsque la boîte de dialogue propose un choix de couleurs ; sinon false. La valeur par défaut est false.

Exemples

L’exemple de code suivant utilise ShowDialog pour afficher un FontDialog. Ce code nécessite qu’un Form élément ait déjà été créé avec un TextBox bouton et un bouton qui lui a été placé. Elle exige également que le fichier fontDialog1 ait été créé. Contient Font les informations de taille, mais pas les informations de couleur.

private:
   void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ )
   {
      fontDialog1->ShowColor = true;

      fontDialog1->Font = textBox1->Font;
      fontDialog1->Color = textBox1->ForeColor;

      if ( fontDialog1->ShowDialog() != ::DialogResult::Cancel )
      {
         textBox1->Font = fontDialog1->Font;
         textBox1->ForeColor = fontDialog1->Color;
      }
   }
private void button1_Click(object sender, System.EventArgs e)
 {
    fontDialog1.ShowColor = true;

    fontDialog1.Font = textBox1.Font;
    fontDialog1.Color = textBox1.ForeColor;

    if(fontDialog1.ShowDialog() != DialogResult.Cancel )
    {
       textBox1.Font = fontDialog1.Font ;
       textBox1.ForeColor = fontDialog1.Color;
    }
 }
Private Sub button1_Click(sender As Object, e As System.EventArgs)
    fontDialog1.ShowColor = True

    fontDialog1.Font = textBox1.Font
    fontDialog1.Color = textBox1.ForeColor

    If fontDialog1.ShowDialog() <> DialogResult.Cancel Then
        textBox1.Font = fontDialog1.Font
        textBox1.ForeColor = fontDialog1.Color
    End If
End Sub

S’applique à

Voir aussi