Compartilhar via


How to: Change the Appearance of the Windows Forms ColorDialog Component

You can configure the appearance of the Windows Forms ColorDialog component with a number of its properties. The dialog box has two sections — one that shows basic colors and one that allows the user to define custom colors.

Most of the properties restrict what colors the user can select from the dialog box. If the AllowFullOpen property is set to true, the user is allowed to define custom colors. The FullOpen property is true if the dialog box is expanded to define custom colors; otherwise the user must click a "Define Custom Colors" button. When the AnyColor property is set to true, the dialog box displays all available colors in the set of basic colors. If the SolidColorOnly property is set to true, the user cannot select dithered colors; only solid colors are available to select.

If the ShowHelp property is set to true, a Help button appears on the dialog box. When the user clicks the Help button, the ColorDialog component's HelpRequest event is raised.

To configure the appearance of the color dialog box

  • Set the AllowFullOpen, AnyColor, SolidColorOnly, and ShowHelp properties to the desired values.

    ColorDialog1.AllowFullOpen = True
    ColorDialog1.AnyColor = True
    ColorDialog1.SolidColorOnly = False
    ColorDialog1.ShowHelp = True
    
    colorDialog1.AllowFullOpen = true;
    colorDialog1.AnyColor = true;
    colorDialog1.SolidColorOnly = false;
    colorDialog1.ShowHelp = true;
    
    colorDialog1.set_AllowFullOpen(true);
    colorDialog1.set_AnyColor(true);
    colorDialog1.set_SolidColorOnly(false);
    colorDialog1.set_ShowHelp(true);
    
    colorDialog1->AllowFullOpen = true;
    colorDialog1->AnyColor = true;
    colorDialog1->SolidColorOnly = false;
    colorDialog1->ShowHelp = true;
    

See Also

Reference

ColorDialog Component Overview (Windows Forms)
ColorDialog Class

Other Resources

ColorDialog Component (Windows Forms)