ColorDialog.AllowFullOpen Proprietà

Definizione

Ottiene o imposta un valore che indica se l'utente può usare la finestra di dialogo per definire colori personalizzati.

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

Valore della proprietà

true se l'utente può definire colori personalizzati; in caso contrario, false. Il valore predefinito è true.

Esempio

Nell'esempio seguente viene illustrata la creazione di un nuovo ColorDialogoggetto . In questo esempio è necessario che il metodo venga chiamato dall'interno di un modulo esistente con e TextBoxButton inserito su di esso.

private:
   void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ )
   {
      ColorDialog^ MyDialog = gcnew ColorDialog;
      // Keeps the user from selecting a custom color.
      MyDialog->AllowFullOpen = false;
      // Allows the user to get help. (The default is false.)
      MyDialog->ShowHelp = true;
      // Sets the initial color select to the current text color.
      MyDialog->Color = textBox1->ForeColor;
      
      // Update the text box color if the user clicks OK 
      if ( MyDialog->ShowDialog() == ::System::Windows::Forms::DialogResult::OK )
      {
         textBox1->ForeColor = MyDialog->Color;
      }
   }
private void button1_Click(object sender, System.EventArgs e)
 {
    ColorDialog MyDialog = new ColorDialog();
    // Keeps the user from selecting a custom color.
    MyDialog.AllowFullOpen = false ;
    // Allows the user to get help. (The default is false.)
    MyDialog.ShowHelp = true ;
    // Sets the initial color select to the current text color.
    MyDialog.Color = textBox1.ForeColor ;
    
    // Update the text box color if the user clicks OK 
    if (MyDialog.ShowDialog() == DialogResult.OK)
        textBox1.ForeColor =  MyDialog.Color;
 }
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim MyDialog As New ColorDialog()
    ' Keeps the user from selecting a custom color.
    MyDialog.AllowFullOpen = False
    ' Allows the user to get help. (The default is false.)
    MyDialog.ShowHelp = True
    ' Sets the initial color select to the current text color,
    MyDialog.Color = TextBox1.ForeColor

    ' Update the text box color if the user clicks OK 
    If (MyDialog.ShowDialog() = Windows.Forms.DialogResult.OK) Then
        TextBox1.ForeColor = MyDialog.Color
    End If
End Sub

Commenti

Se impostato su false, il pulsante associato nella finestra di dialogo è disabilitato e l'utente non può accedere al controllo colori personalizzati nella finestra di dialogo.

Si applica a

Vedi anche