ColorHelper.cs 507 B

12345678910111213141516171819
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. namespace Bowin.Common.Utility
  6. {
  7. public static class ColorHelper
  8. {
  9. public static string ToRGBString(this System.Drawing.Color color)
  10. {
  11. var hexString = string.Format("{0:X}", color.R).PadLeft(2, '0')
  12. + string.Format("{0:X}", color.G).PadLeft(2, '0')
  13. + string.Format("{0:X}", color.B).PadLeft(2, '0');
  14. return hexString;
  15. }
  16. }
  17. }