Name

ColorDialog

Synopsis

This common dialog allows you to present a standard interface to allow the user to select and define a color. You can programmatically show or hide the custom color definition part of the dialog by default by specifying the FullOpen property, and you can predefine the set of custom colors by using the CustomColors property. Unfortunately, this betrays its interop origins, because the colors have to be specified as Int32 values encapsulating the ARGB color, rather than as an array of System.Drawing.Color values.

You can retrieve the user’s selection through the System.Drawing.Color property.


public class ColorDialog : CommonDialog {

// Public Constructors

   public ColorDialog();

// Public Instance Properties

   public virtual bool AllowFullOpen{set; get; }

   public virtual bool AnyColor{set; get; }

   public Color Color{set; get; }

   public int[ ] CustomColors{set; get; }

   public virtual bool FullOpen{set; get; }

   public virtual bool ShowHelp{set; get; }

   public virtual bool SolidColorOnly{set; get; }

// Protected Instance Properties

   protected virtual IntPtr Instance{get; }

   protected virtual int Options{get; }

// Public Instance Methods

   public override void Reset();  // overrides CommonDialog

   public override string ToString();  // overrides System.ComponentModel.Component

                  // Protected Instance Methods

   protected override bool RunDialog(IntPtr hwndOwner);  // overrides CommonDialog

}

Hierarchy

System.Object System.MarshalByRefObject System.ComponentModel.Component(System.ComponentModel.IComponen, ...

Get .NET Windows Forms in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.