Преобразовать Color в Brush в .NET

Published in Полезные советы

Как преобразовать в .NET Color в Brush? Просто:

Private Shared Function ColorToBrush(clr As System.Drawing.Color) As Brush
	Dim rgb As Integer = clr.ToArgb()
    Dim color = System.Windows.Media.Color.FromArgb(CByte(rgb >> 24 And &HFF), CByte(rgb >> 16 And &HFF), CByte(rgb >> 8 And &HFF), CByte(rgb And &HFF))
    Dim brsh As New SolidColorBrush(color) 
    Return brsh
End Function    
Читать далее...
Subscribe to this RSS feed