Posted By

dzr_gregory on 10/26/10


Tagged

c color conversion WPF WindowsForms


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

Tyster


WPF to/from WindowsForms colors conversion


 / Published in: C#
 

  1. /// <summary>
  2. /// Преобразует цвет WPF в цвет WindowsForms
  3. /// </summary>
  4. /// <param name="color">Цвет WPF</param>
  5. /// <returns>Цвет Windows Forms</returns>
  6. public static System.Drawing.Color ToColor(this System.Windows.Media.Color color)
  7. {
  8. return Color.FromArgb(color.A, color.R, color.G, color.B);
  9. }
  10.  
  11. /// <summary>
  12. /// Преобразует цвет Windows Forms в цвет WPF
  13. /// </summary>
  14. /// <param name="color">Цвет WindowsForms</param>
  15. /// <returns>Цвет WPF</returns>
  16. public static System.Windows.Media.Color ToColor(this System.Drawing.Color color)
  17. {
  18. return System.Windows.Media.Color.FromArgb(color.A, color.R, color.G, color.B);
  19. }

Report this snippet  

You need to login to post a comment.