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。 此示例要求从具有 TextBox 并 Button 放置在它的现有窗体中调用 方法。
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