Freigeben über


ColorDialog.ShowHelp-Eigenschaft

Ruft einen Wert ab, der angibt, ob im Farbendialogfeld eine Hilfeschaltfläche angezeigt wird, oder legt diesen fest.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

Syntax

'Declaration
Public Overridable Property ShowHelp As Boolean
'Usage
Dim instance As ColorDialog
Dim value As Boolean

value = instance.ShowHelp

instance.ShowHelp = value
public virtual bool ShowHelp { get; set; }
public:
virtual property bool ShowHelp {
    bool get ();
    void set (bool value);
}
/** @property */
public boolean get_ShowHelp ()

/** @property */
public void set_ShowHelp (boolean value)
public function get ShowHelp () : boolean

public function set ShowHelp (value : boolean)

Eigenschaftenwert

true, wenn die Hilfeschaltfläche im Dialogfeld angezeigt wird, andernfalls false. Der Standardwert ist false.

Beispiel

Im folgenden Codebeispiel wird das Erstellen eines neuen ColorDialog veranschaulicht. Für dieses Beispiel ist es erforderlich, dass die Methode aus einem vorhandenen Formular heraus aufgerufen wird, in dem eine TextBox und ein Button platziert sind.

Private Sub button1_Click(sender As Object, e As System.EventArgs)
    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() = DialogResult.OK) Then
        textBox1.ForeColor =  MyDialog.Color
    End If

End Sub 'button1_Click
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:
   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() == ::DialogResult::OK )
      {
         textBox1->ForeColor = MyDialog->Color;
      }
   }
protected void button1_Click(Object sender, System.EventArgs e)
{
    ColorDialog myDialog = new ColorDialog();
    // Keeps the user from selecting a custom color.
    myDialog.set_AllowFullOpen(false);
    // Allows the user to get help. (The default is false.)
    myDialog.set_ShowHelp(true);
    // Sets the initial color select to the current text color.
    myDialog.set_Color(textBox1.get_ForeColor());
    // Update the text box color if the user clicks OK 
    if (myDialog.ShowDialog().Equals(get_DialogResult().OK)) {
        textBox1.set_ForeColor(myDialog.get_Color());
    }
} //button1_Click

Plattformen

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

Siehe auch

Referenz

ColorDialog-Klasse
ColorDialog-Member
System.Windows.Forms-Namespace