system.drawing.color

Convert System.Drawing.Color to RGB and Hex Value

Using C# I was trying to develop the following two. The way I am doing it may have some problem and need your kind advice. In addition, I dont know whether there is any existing method to do the same. private static String HexConverter(System.Drawing.Color c) { String rtn = String.Empty; try { rtn = "#" + c.R.ToStrin...

Databinding custom XML serializable Color class in C#

I have a class, SerializableColor, to allow me to XML serialize Colors. public class SerializableColor { // omitted constructors, etc. ... [XmlIgnore] public Color Color { get { return Color.FromArgb(this.Alpha, this.Red, this.Green, this.Blue); } set { this.Alpha = value.A; ...

How to make System.Drawing.Color both serializable and editable with propertygrid?

Basically i have a settings class like this: class Settings { Color BackgroundColor {get;set;} Color ForegroundColor {get;set;} Color GridColor {get;set;} Color HighlightColor {get;set;} //... etc } And i want to be able to do both - serialize the settings class and edit the colors in propertygrid. The solution I've come ...