ExtensionMethod.NET Home of 846 C#, Visual Basic, F# and Javascript extension methods


Converts a System.Windows.Media.Color (WPF) into System.Drawing.Color (WinForms) In mixed projects using Windows-Forms and WPF, there is sometimes the need to convert colors between both.


  Public Function ToFormsColor(color As Windows.Media.Color) As System.Drawing.Color
    Return System.Drawing.Color.FromArgb(color.A, color.R, color.G, color.B)
  End Function


ExampleWinFormsLabel.BackColor = MyWPFSolidColorBrush.Color.ToFormsColor

Author: Markus Schmitz

Submitted on: 23 mrt 2012

Language: VB

Type: Windows.Media.Color

Views: 3449