Public Class ColorSlider
Inherits XamSimpleSliderBase(Of Color)
Protected Overloads Overrides Function DoubleToValue(ByVal value As
Double) As Color
Dim pixel As Integer = CInt(value)
'int を RGBA 値にシフトします
Dim B As Byte = CByte((pixel And &HFF))
pixel >>= 8
Dim G As Byte = CByte((pixel And &HFF))
pixel >>= 8
Dim R As Byte = CByte((pixel And &HFF))
pixel >>= 8
' alpha
Dim A As Byte = CByte(pixel)
Return Color.FromArgb(A, R, G, B)
End Function
Protected Overloads Overrides Function ValueToDouble(ByVal value As
Color) As Double
Return (value.A << 24 Or value.R << 16 Or value.G << 8 Or value.B)
End Function
Protected Overloads Overrides Function GetParameter(ByVal source As
CommandSource) As Object
If TypeOf source.Command Is xamSliderBaseCommandBase Then
Return (Me)
End If
Return (Nothing)
End Function
Protected Overloads Overrides Function SupportsCommand(ByVal command As
ICommand) As Boolean
Return (TypeOf command Is xamSliderBaseCommandBase)
End Function
End Class