ColorDialog.ShowHelp 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得或設定值,指出是否在色彩對話方塊中顯示 [說明] 按鈕。
public:
virtual property bool ShowHelp { bool get(); void set(bool value); };
public virtual bool ShowHelp { get; set; }
member this.ShowHelp : bool with get, set
Public Overridable Property ShowHelp As Boolean
屬性值
如果 [說明] 按鈕顯示在對話方塊中,則為 true
,否則為 false
。 預設值是 false
。
範例
下列程式碼範例說明如何建立新的 ColorDialog 。 這個範例會要求從現有表單內呼叫 方法,且該表單上已 TextBoxButton 放置 和 。
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