vb.netbrushes

VB.net How can I check if two brushes are the same or same color?


How can I find out if two brushes are equal

tColor1 = New BrushConverter().ConvertFrom("#FF89DE93")
tColor2 = New BrushConverter().ConvertFrom("#FF89DE93")
tColor3 = Brushes.LightGray

How can I compare these burshes and get true for tColor1 = tColor2 and false for tColor1 = tColor3?


Solution

  •     Dim tColor1 As SolidColorBrush = CType(New BrushConverter().ConvertFrom("#FF89DE93"), SolidColorBrush)
        Dim tColor2 As SolidColorBrush = CType(New BrushConverter().ConvertFrom("#FF89DE93"), SolidColorBrush)
        Dim tColor3 = Brushes.LightGray
    
        Dim test As Boolean
    
    
        test = tColor1.Color = tColor2.Color 'True
        test = tColor1.Color = tColor3.Color 'False