The competent programmer is fully aware of the strictly limited size of his own skull; therefore he approaches the programming task in full humility, and among other things he avoids clever tricks like the plague. -- Edsger Dijkstra
Welcome to my blog about software development and the Microsoft stack.

I've been a full time .NET developer for ten years, but I didn't start my professional life as a programmer ... more
Share/Print this page:

Subscribe for news, updates and more:

Please enter your reply for the comment shown below:

Post Your Comment
  You may post without logging in or login here.
Display Name: Required.
Email: Required. Will not be shown. Used for identicon.
Comment:
Allowed tags: <quote></quote>, <code></code>, <b></b>, <i></i>, <u></u>, <red></red>
 
   Please type text as shown in the image at left.
Posted 2009 Mar 12 19:46 PM. reply
Uh, how about this:


int argb = int.Parse("ff" + color.Substring(1,color.Length-1), System.Globalization.NumberStyles.HexNumber);
return System.Drawing.Color.FromArgb(argb);


Rule of thumb: .NET has pretty much a solution for any kind of common problem built in, whenever you have to resort to string parsing and concatenating, you are usually doing something terribly wrong.

-- georg

BioGeorg