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


Converts a System.Drawing.Color (e.g. from a ColorDialog) into a System.Windows.Media.Color for WPF


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


If ColorDialog.ShowDialog = Windows.Forms.DialogResult.OK Then
  MyWpfBrushProperty = New Windows.Media.SolidColorBrush(ColorDialog.Color.ToWpfColor)
End If

Author: Markus Schmitz

Submitted on: 23 mrt 2012

Language: VB

Type: System.Drawing.Color

Views: 2965