WPF to/from WindowsForms colors conversion


/ Published in: C#
Save to your folder(s)



Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.