DekGenius.com
[ Team LiB ] Previous Section Next Section

Colorserializable

System.Drawing (system.drawing.dll)struct

The Color structure is a value type that represents a point in the RGB color space, with optional support for a transparency alpha channel.

You can obtain the value of a particular Color by using one of the static properties that return a well-known web color. Alternatively, FromArgb() allows you to define a specific color from its red, green, blue, and alpha components. FromKnownColor() allows you to create a Color from an entry in KnownColor enumeration, and FromName() takes a string containing the name of well-known color.

There is also a special field, Empty, which represents a null color. This is necessary because Color is a value type, and therefore nullness cannot be represented by a null reference. It is usually used when a class can optionally inherit its color from an ambient property (e.g., the ForeColor of a Control is inherited from its Parent if set to Empty). The IsEmpty property allows you to check for nullness.

There are properties that allow you to retrieve the A, R, G, and B values of the color, and the color's Name (either the well-known name or a string description of the ARGB values as appropriate). In addition, there are methods—GetHue(), GetSaturation(), and GetBrightness()—to transform the values to the HSB color space.

If you need to know whether a color is well-known, you can use the IsKnownColor, IsNamedColor, and IsSystemColor properties.

The Color structure is used pervasively throughout the framework wherever color is needed.

public struct Color {
// Public Static Fields
   public static readonly Color Empty;  // = Color [Empty]
// Public Static Properties
   public static Color AliceBlue{get; }
   public static Color AntiqueWhite{get; }
   public static Color Aqua{get; }
   public static Color Aquamarine{get; }
   public static Color Azure{get; }
   public static Color Beige{get; }
   public static Color Bisque{get; }
   public static Color Black{get; }
   public static Color BlanchedAlmond{get; }
   public static Color Blue{get; }
   public static Color BlueViolet{get; }
   public static Color Brown{get; }
   public static Color BurlyWood{get; }
   public static Color CadetBlue{get; }
   public static Color Chartreuse{get; }
   public static Color Chocolate{get; }
   public static Color Coral{get; }
   public static Color CornflowerBlue{get; }
   public static Color Cornsilk{get; }
   public static Color Crimson{get; }
   public static Color Cyan{get; }
   public static Color DarkBlue{get; }
   public static Color DarkCyan{get; }
   public static Color DarkGoldenrod{get; }
   public static Color DarkGray{get; }
   public static Color DarkGreen{get; }
   public static Color DarkKhaki{get; }
   public static Color DarkMagenta{get; }
   public static Color DarkOliveGreen{get; }
   public static Color DarkOrange{get; }
   public static Color DarkOrchid{get; }
   public static Color DarkRed{get; }
   public static Color DarkSalmon{get; }
   public static Color DarkSeaGreen{get; }
   public static Color DarkSlateBlue{get; }
   public static Color DarkSlateGray{get; }
   public static Color DarkTurquoise{get; }
   public static Color DarkViolet{get; }
   public static Color DeepPink{get; }
   public static Color DeepSkyBlue{get; }
   public static Color DimGray{get; }
   public static Color DodgerBlue{get; }
   public static Color Firebrick{get; }
   public static Color FloralWhite{get; }
   public static Color ForestGreen{get; }
   public static Color Fuchsia{get; }
   public static Color Gainsboro{get; }
   public static Color GhostWhite{get; }
   public static Color Gold{get; }
   public static Color Goldenrod{get; }
   public static Color Gray{get; }
   public static Color Green{get; }
   public static Color GreenYellow{get; }
   public static Color Honeydew{get; }
   public static Color HotPink{get; }
   public static Color IndianRed{get; }
   public static Color Indigo{get; }
   public static Color Ivory{get; }
   public static Color Khaki{get; }
   public static Color Lavender{get; }
   public static Color LavenderBlush{get; }
   public static Color LawnGreen{get; }
   public static Color LemonChiffon{get; }
   public static Color LightBlue{get; }
   public static Color LightCoral{get; }
   public static Color LightCyan{get; }
   public static Color LightGoldenrodYellow{get; }
   public static Color LightGray{get; }
   public static Color LightGreen{get; }
   public static Color LightPink{get; }
   public static Color LightSalmon{get; }
   public static Color LightSeaGreen{get; }
   public static Color LightSkyBlue{get; }
   public static Color LightSlateGray{get; }
   public static Color LightSteelBlue{get; }
   public static Color LightYellow{get; }
   public static Color Lime{get; }
   public static Color LimeGreen{get; }
   public static Color Linen{get; }
   public static Color Magenta{get; }
   public static Color Maroon{get; }
   public static Color MediumAquamarine{get; }
   public static Color MediumBlue{get; }
   public static Color MediumOrchid{get; }
   public static Color MediumPurple{get; }
   public static Color MediumSeaGreen{get; }
   public static Color MediumSlateBlue{get; }
   public static Color MediumSpringGreen{get; }
   public static Color MediumTurquoise{get; }
   public static Color MediumVioletRed{get; }
   public static Color MidnightBlue{get; }
   public static Color MintCream{get; }
   public static Color MistyRose{get; }
   public static Color Moccasin{get; }
   public static Color NavajoWhite{get; }
   public static Color Navy{get; }
   public static Color OldLace{get; }
   public static Color Olive{get; }
   public static Color OliveDrab{get; }
   public static Color Orange{get; }
   public static Color OrangeRed{get; }
   public static Color Orchid{get; }
   public static Color PaleGoldenrod{get; }
   public static Color PaleGreen{get; }
   public static Color PaleTurquoise{get; }
   public static Color PaleVioletRed{get; }
   public static Color PapayaWhip{get; }
   public static Color PeachPuff{get; }
   public static Color Peru{get; }
   public static Color Pink{get; }
   public static Color Plum{get; }
   public static Color PowderBlue{get; }
   public static Color Purple{get; }
   public static Color Red{get; }
   public static Color RosyBrown{get; }
   public static Color RoyalBlue{get; }
   public static Color SaddleBrown{get; }
   public static Color Salmon{get; }
   public static Color SandyBrown{get; }
   public static Color SeaGreen{get; }
   public static Color SeaShell{get; }
   public static Color Sienna{get; }
   public static Color Silver{get; }
   public static Color SkyBlue{get; }
   public static Color SlateBlue{get; }
   public static Color SlateGray{get; }
   public static Color Snow{get; }
   public static Color SpringGreen{get; }
   public static Color SteelBlue{get; }
   public static Color Tan{get; }
   public static Color Teal{get; }
   public static Color Thistle{get; }
   public static Color Tomato{get; }
   public static Color Transparent{get; }
   public static Color Turquoise{get; }
   public static Color Violet{get; }
   public static Color Wheat{get; }
   public static Color White{get; }
   public static Color WhiteSmoke{get; }
   public static Color Yellow{get; }
   public static Color YellowGreen{get; }
// Public Instance Properties
   public byte A{get; }
   public byte B{get; }
   public byte G{get; }
   public bool IsEmpty{get; }
   public bool IsKnownColor{get; }
   public bool IsNamedColor{get; }
   public bool IsSystemColor{get; }
   public string Name{get; }
   public byte R{get; }
// Public Static Methods
   public static Color FromArgb(int argb);
   public static Color FromArgb(int alpha, Color baseColor);
   public static Color FromArgb(int red, int green,  int blue);
   public static Color FromArgb(int alpha, int red, int green, int blue);
   public static Color FromKnownColor(KnownColor color);
   public static Color FromName(string name);
   public static bool operator !=(Color left,  Color right);
   public static bool operator ==(Color left,  Color right);
// Public Instance Methods
   public override bool Equals(object obj);  // overrides ValueType
   public float GetBrightness();
   public override int GetHashCode();  // overrides ValueType
   public float GetHue();
   public float GetSaturation();
   public int ToArgb();
   public KnownColor ToKnownColor();
   public override string ToString();  // overrides ValueType
}

Hierarchy

System.Object System.ValueType Color

Returned By

Multiple types

Passed To

Multiple types

    [ Team LiB ] Previous Section Next Section