FontDialog.ShowColor Propriedade

Definição

Obtém ou define um valor que indica se a caixa de diálogo exibe a opção de cor.

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

Valor da propriedade

Boolean

true se a caixa de diálogo exibir a opção de cor; caso contrário, false. O valor padrão é false.

Exemplos

O exemplo de código a seguir usa ShowDialog para exibir um FontDialog. Esse código requer que um Form já tenha sido criado com um botão e um TextBox botão colocado nele. Ele também requer que o fontDialog1 tenha sido criado. Contém Font as informações de tamanho, mas não as informações de cor.

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

Aplica-se a

Confira também