Imports System.Drawing Imports System.Runtime.InteropServices Namespace System.Drawing Public Class SystemColorsEx #Region "SetSchemeByName" #Region "SchemeName" Public Enum SchemeName Brick = 1 Desert Eggplant HighContrastBlack HighContrastWhite Lilac = 6 'Maple 'Marine 'Rose Spruce = 10 Storm = 11 'Wheat WindowsStandard = 13 End Enum #End Region Public Shared Sub SetSchemeByName(ByVal aSchemeName As SchemeName) If aSchemeName < 1 OrElse aSchemeName > 13 Then Throw New ApplicationException("Please use the enum and don't make up values") End If Dim el As Int32() = {0 Or SYS_COLOR_INDEX_FLAG, 1 Or SYS_COLOR_INDEX_FLAG, 2 Or SYS_COLOR_INDEX_FLAG, 3 Or SYS_COLOR_INDEX_FLAG, 4 Or SYS_COLOR_INDEX_FLAG, 5 Or SYS_COLOR_INDEX_FLAG, 6 Or SYS_COLOR_INDEX_FLAG, 7 Or SYS_COLOR_INDEX_FLAG, 8 Or SYS_COLOR_INDEX_FLAG, 9 Or SYS_COLOR_INDEX_FLAG, 10 Or SYS_COLOR_INDEX_FLAG, 11 Or SYS_COLOR_INDEX_FLAG, 12 Or SYS_COLOR_INDEX_FLAG, 13 Or SYS_COLOR_INDEX_FLAG, 14 Or SYS_COLOR_INDEX_FLAG, 15 Or SYS_COLOR_INDEX_FLAG, 16 Or SYS_COLOR_INDEX_FLAG, 17 Or SYS_COLOR_INDEX_FLAG, 18 Or SYS_COLOR_INDEX_FLAG, 19 Or SYS_COLOR_INDEX_FLAG, 20 Or SYS_COLOR_INDEX_FLAG, 21 Or SYS_COLOR_INDEX_FLAG, 22 Or SYS_COLOR_INDEX_FLAG, 23 Or SYS_COLOR_INDEX_FLAG, 24 Or SYS_COLOR_INDEX_FLAG, 25 Or SYS_COLOR_INDEX_FLAG, 26 Or SYS_COLOR_INDEX_FLAG, 27 Or SYS_COLOR_INDEX_FLAG, 28 Or SYS_COLOR_INDEX_FLAG} Dim rgbs As Int32() = GetArrayOfRGBs(aSchemeName) If SetSysColors(29, el, rgbs) = False Then Throw New ApplicationException(Marshal.GetLastWin32Error().ToString()) End If ' write the name to the registry Dim n As String Select Case aSchemeName Case SchemeName.HighContrastBlack n = "High Contrast Black" Case SchemeName.HighContrastWhite n = "High Contrast White" Case SchemeName.WindowsStandard n = "Windows Standard" Case Else n = aSchemeName.ToString() End Select ' TODO write to registry the name (key: HKEY_CURRENT_USER\ControlPanel\Appearance name:Current) End Sub Private Shared Function GetArrayOfRGBs(ByVal aSchemeName As SchemeName) As Int32() Select Case aSchemeName Case SchemeName.Brick Return GetBrick() Case SchemeName.Desert Return GetDesert() Case SchemeName.Eggplant Return GetEggplant() Case SchemeName.HighContrastBlack Return GetHighContrastBlack() Case SchemeName.HighContrastWhite Return GetHighContrastWhite() Case SchemeName.Lilac Return GetLilac() Case SchemeName.Spruce Return GetSpruce() Case SchemeName.Storm Return GetStorm() Case SchemeName.WindowsStandard Return GetWindowsStandard() 'Case SchemeName.Maple, SchemeName.Marine, SchemeName.Rose, SchemeName.Wheat ' Throw New NotSupportedException("Maple, Marine, Rose requires non-zero alpha") End Select End Function Private Shared Function GetEggplant() As Int32() Return New Int32() { _ BitConverter.ToInt32(New Byte() {213, 231, 211, 0}, 0), BitConverter.ToInt32(New Byte() {64, 0, 64, 0}, 0) _ , BitConverter.ToInt32(New Byte() {77, 0, 77, 0}, 0), BitConverter.ToInt32(New Byte() {165, 80, 141, 0}, 0) _ , BitConverter.ToInt32(New Byte() {91, 152, 86, 0}, 0), BitConverter.ToInt32(New Byte() {255, 255, 255, 0}, 0) _ , BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0), BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0) _ , BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0), BitConverter.ToInt32(New Byte() {255, 255, 255, 0}, 0) _ , BitConverter.ToInt32(New Byte() {91, 152, 86, 0}, 0), BitConverter.ToInt32(New Byte() {91, 152, 86, 0}, 0) _ , BitConverter.ToInt32(New Byte() {128, 128, 128, 0}, 0), BitConverter.ToInt32(New Byte() {55, 92, 52, 0}, 0) _ , BitConverter.ToInt32(New Byte() {255, 255, 255, 0}, 0), BitConverter.ToInt32(New Byte() {91, 152, 86, 0}, 0) _ , BitConverter.ToInt32(New Byte() {128, 128, 128, 0}, 0), BitConverter.ToInt32(New Byte() {120, 82, 109, 0}, 0) _ , BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0), BitConverter.ToInt32(New Byte() {79, 79, 79, 0}, 0) _ , BitConverter.ToInt32(New Byte() {160, 201, 156, 0}, 0), BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0) _ , BitConverter.ToInt32(New Byte() {255, 255, 255, 0}, 0), BitConverter.ToInt32(New Byte() {128, 0, 128, 0}, 0) _ , BitConverter.ToInt32(New Byte() {255, 255, 255, 0}, 0), BitConverter.ToInt32(New Byte() {91, 152, 86, 0}, 0) _ , BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0), BitConverter.ToInt32(New Byte() {16, 132, 208, 0}, 0) _ , BitConverter.ToInt32(New Byte() {181, 181, 181, 0}, 0) _ } End Function Private Shared Function GetHighContrastBlack() As Int32() Return New Int32() { _ BitConverter.ToInt32(New Byte() {192, 192, 192, 0}, 0), BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0) _ , BitConverter.ToInt32(New Byte() {128, 0, 128, 0}, 0), BitConverter.ToInt32(New Byte() {0, 128, 0, 0}, 0) _ , BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0), BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0) _ , BitConverter.ToInt32(New Byte() {255, 255, 255, 0}, 0), BitConverter.ToInt32(New Byte() {255, 255, 255, 0}, 0) _ , BitConverter.ToInt32(New Byte() {255, 255, 255, 0}, 0), BitConverter.ToInt32(New Byte() {255, 255, 255, 0}, 0) _ , BitConverter.ToInt32(New Byte() {128, 128, 128, 0}, 0), BitConverter.ToInt32(New Byte() {192, 192, 192, 0}, 0) _ , BitConverter.ToInt32(New Byte() {128, 128, 128, 0}, 0), BitConverter.ToInt32(New Byte() {255, 255, 255, 0}, 0) _ , BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0), BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0) _ , BitConverter.ToInt32(New Byte() {128, 128, 128, 0}, 0), BitConverter.ToInt32(New Byte() {128, 128, 128, 0}, 0) _ , BitConverter.ToInt32(New Byte() {255, 255, 255, 0}, 0), BitConverter.ToInt32(New Byte() {255, 255, 255, 0}, 0) _ , BitConverter.ToInt32(New Byte() {192, 192, 192, 0}, 0), BitConverter.ToInt32(New Byte() {255, 255, 255, 0}, 0) _ , BitConverter.ToInt32(New Byte() {192, 192, 192, 0}, 0), BitConverter.ToInt32(New Byte() {255, 255, 255, 0}, 0) _ , BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0), BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0) _ , BitConverter.ToInt32(New Byte() {255, 255, 255, 0}, 0), BitConverter.ToInt32(New Byte() {16, 132, 208, 0}, 0) _ , BitConverter.ToInt32(New Byte() {181, 181, 181, 0}, 0) _ } End Function Private Shared Function GetHighContrastWhite() As Int32() Return New Int32() { _ BitConverter.ToInt32(New Byte() {255, 255, 255, 0}, 0), BitConverter.ToInt32(New Byte() {255, 255, 255, 0}, 0) _ , BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0), BitConverter.ToInt32(New Byte() {255, 255, 255, 0}, 0) _ , BitConverter.ToInt32(New Byte() {255, 255, 255, 0}, 0), BitConverter.ToInt32(New Byte() {255, 255, 255, 0}, 0) _ , BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0), BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0) _ , BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0), BitConverter.ToInt32(New Byte() {255, 255, 255, 0}, 0) _ , BitConverter.ToInt32(New Byte() {128, 128, 128, 0}, 0), BitConverter.ToInt32(New Byte() {192, 192, 192, 0}, 0) _ , BitConverter.ToInt32(New Byte() {128, 128, 128, 0}, 0), BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0) _ , BitConverter.ToInt32(New Byte() {255, 255, 255, 0}, 0), BitConverter.ToInt32(New Byte() {255, 255, 255, 0}, 0) _ , BitConverter.ToInt32(New Byte() {128, 128, 128, 0}, 0), BitConverter.ToInt32(New Byte() {128, 128, 128, 0}, 0) _ , BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0), BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0) _ , BitConverter.ToInt32(New Byte() {192, 192, 192, 0}, 0), BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0) _ , BitConverter.ToInt32(New Byte() {192, 192, 192, 0}, 0), BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0) _ , BitConverter.ToInt32(New Byte() {255, 255, 255, 0}, 0), BitConverter.ToInt32(New Byte() {255, 255, 255, 0}, 0) _ , BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0), BitConverter.ToInt32(New Byte() {16, 132, 208, 0}, 0) _ , BitConverter.ToInt32(New Byte() {181, 181, 181, 0}, 0) _ } End Function Private Shared Function GetLilac() As Int32() Return New Int32() { _ BitConverter.ToInt32(New Byte() {163, 168, 217, 0}, 0), BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0) _ , BitConverter.ToInt32(New Byte() {90, 78, 177, 0}, 0), BitConverter.ToInt32(New Byte() {128, 128, 128, 0}, 0) _ , BitConverter.ToInt32(New Byte() {163, 168, 217, 0}, 0), BitConverter.ToInt32(New Byte() {255, 255, 255, 0}, 0) _ , BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0), BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0) _ , BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0), BitConverter.ToInt32(New Byte() {255, 255, 255, 0}, 0) _ , BitConverter.ToInt32(New Byte() {163, 168, 217, 0}, 0), BitConverter.ToInt32(New Byte() {163, 168, 217, 0}, 0) _ , BitConverter.ToInt32(New Byte() {90, 78, 177, 0}, 0), BitConverter.ToInt32(New Byte() {90, 78, 177, 0}, 0) _ , BitConverter.ToInt32(New Byte() {255, 255, 255, 0}, 0), BitConverter.ToInt32(New Byte() {163, 168, 217, 0}, 0) _ , BitConverter.ToInt32(New Byte() {128, 128, 128, 0}, 0), BitConverter.ToInt32(New Byte() {105, 105, 105, 0}, 0) _ , BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0), BitConverter.ToInt32(New Byte() {255, 255, 255, 0}, 0) _ , BitConverter.ToInt32(New Byte() {216, 168, 236, 0}, 0), BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0) _ , BitConverter.ToInt32(New Byte() {255, 255, 255, 0}, 0), BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0) _ , BitConverter.ToInt32(New Byte() {255, 255, 255, 0}, 0), BitConverter.ToInt32(New Byte() {163, 168, 217, 0}, 0) _ , BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0), BitConverter.ToInt32(New Byte() {16, 132, 208, 0}, 0) _ , BitConverter.ToInt32(New Byte() {181, 181, 181, 0}, 0) _ } End Function Private Shared Function GetSpruce() As Int32() Return New Int32() { _ BitConverter.ToInt32(New Byte() {208, 227, 211, 0}, 0), BitConverter.ToInt32(New Byte() {46, 88, 46, 0}, 0) _ , BitConverter.ToInt32(New Byte() {89, 151, 100, 0}, 0), BitConverter.ToInt32(New Byte() {127, 127, 127, 0}, 0) _ , BitConverter.ToInt32(New Byte() {162, 200, 169, 0}, 0), BitConverter.ToInt32(New Byte() {255, 255, 255, 0}, 0) _ , BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0), BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0) _ , BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0), BitConverter.ToInt32(New Byte() {255, 255, 255, 0}, 0) _ , BitConverter.ToInt32(New Byte() {162, 200, 169, 0}, 0), BitConverter.ToInt32(New Byte() {162, 200, 169, 0}, 0) _ , BitConverter.ToInt32(New Byte() {208, 227, 211, 0}, 0), BitConverter.ToInt32(New Byte() {89, 151, 100, 0}, 0) _ , BitConverter.ToInt32(New Byte() {255, 255, 255, 0}, 0), BitConverter.ToInt32(New Byte() {162, 200, 169, 0}, 0) _ , BitConverter.ToInt32(New Byte() {128, 128, 128, 0}, 0), BitConverter.ToInt32(New Byte() {99, 165, 99, 0}, 0) _ , BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0), BitConverter.ToInt32(New Byte() {208, 227, 211, 0}, 0) _ , BitConverter.ToInt32(New Byte() {208, 227, 211, 0}, 0), BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0) _ , BitConverter.ToInt32(New Byte() {255, 255, 255, 0}, 0), BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0) _ , BitConverter.ToInt32(New Byte() {255, 255, 255, 0}, 0), BitConverter.ToInt32(New Byte() {162, 200, 169, 0}, 0) _ , BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0), BitConverter.ToInt32(New Byte() {16, 132, 208, 0}, 0) _ , BitConverter.ToInt32(New Byte() {181, 181, 181, 0}, 0) _ } End Function Private Shared Function GetStorm() As Int32() Return New Int32() { _ BitConverter.ToInt32(New Byte() {231, 231, 231, 0}, 0), BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0) _ , BitConverter.ToInt32(New Byte() {0, 0, 47, 0}, 0), BitConverter.ToInt32(New Byte() {128, 128, 128, 0}, 0) _ , BitConverter.ToInt32(New Byte() {192, 192, 192, 0}, 0), BitConverter.ToInt32(New Byte() {255, 255, 255, 0}, 0) _ , BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0), BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0) _ , BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0), BitConverter.ToInt32(New Byte() {255, 255, 255, 0}, 0) _ , BitConverter.ToInt32(New Byte() {160, 160, 160, 0}, 0), BitConverter.ToInt32(New Byte() {160, 160, 160, 0}, 0) _ , BitConverter.ToInt32(New Byte() {128, 128, 128, 0}, 0), BitConverter.ToInt32(New Byte() {0, 0, 102, 0}, 0) _ , BitConverter.ToInt32(New Byte() {255, 255, 255, 0}, 0), BitConverter.ToInt32(New Byte() {160, 160, 160, 0}, 0) _ , BitConverter.ToInt32(New Byte() {128, 128, 128, 0}, 0), BitConverter.ToInt32(New Byte() {128, 128, 128, 0}, 0) _ , BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0), BitConverter.ToInt32(New Byte() {36, 36, 36, 0}, 0) _ , BitConverter.ToInt32(New Byte() {231, 231, 231, 0}, 0), BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0) _ , BitConverter.ToInt32(New Byte() {255, 255, 255, 0}, 0), BitConverter.ToInt32(New Byte() {128, 0, 128, 0}, 0) _ , BitConverter.ToInt32(New Byte() {255, 255, 255, 0}, 0), BitConverter.ToInt32(New Byte() {160, 160, 160, 0}, 0) _ , BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0), BitConverter.ToInt32(New Byte() {16, 132, 208, 0}, 0) _ , BitConverter.ToInt32(New Byte() {181, 181, 181, 0}, 0) _ } End Function Private Shared Function GetWindowsStandard() As Int32() Return New Int32() { _ BitConverter.ToInt32(New Byte() {224, 224, 224, 0}, 0), BitConverter.ToInt32(New Byte() {58, 110, 165, 0}, 0) _ , BitConverter.ToInt32(New Byte() {0, 0, 128, 0}, 0), BitConverter.ToInt32(New Byte() {128, 128, 128, 0}, 0) _ , BitConverter.ToInt32(New Byte() {192, 192, 192, 0}, 0), BitConverter.ToInt32(New Byte() {255, 255, 255, 0}, 0) _ , BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0), BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0) _ , BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0), BitConverter.ToInt32(New Byte() {255, 255, 255, 0}, 0) _ , BitConverter.ToInt32(New Byte() {192, 192, 192, 0}, 0), BitConverter.ToInt32(New Byte() {192, 192, 192, 0}, 0) _ , BitConverter.ToInt32(New Byte() {128, 128, 128, 0}, 0), BitConverter.ToInt32(New Byte() {0, 0, 128, 0}, 0) _ , BitConverter.ToInt32(New Byte() {255, 255, 255, 0}, 0), BitConverter.ToInt32(New Byte() {192, 192, 192, 0}, 0) _ , BitConverter.ToInt32(New Byte() {128, 128, 128, 0}, 0), BitConverter.ToInt32(New Byte() {128, 128, 128, 0}, 0) _ , BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0), BitConverter.ToInt32(New Byte() {192, 192, 192, 0}, 0) _ , BitConverter.ToInt32(New Byte() {255, 255, 255, 0}, 0), BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0) _ , BitConverter.ToInt32(New Byte() {223, 223, 223, 0}, 0), BitConverter.ToInt32(New Byte() {128, 0, 128, 0}, 0) _ , BitConverter.ToInt32(New Byte() {255, 255, 255, 0}, 0), BitConverter.ToInt32(New Byte() {192, 192, 192, 0}, 0) _ , BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0), BitConverter.ToInt32(New Byte() {16, 132, 208, 0}, 0) _ , BitConverter.ToInt32(New Byte() {181, 181, 181, 0}, 0) _ } End Function Private Shared Function GetBrick() As Int32() Return New Int32() { _ BitConverter.ToInt32(New Byte() {232, 231, 221, 0}, 0), BitConverter.ToInt32(New Byte() {155, 0, 0, 0}, 0) _ , BitConverter.ToInt32(New Byte() {128, 0, 0, 0}, 0), BitConverter.ToInt32(New Byte() {141, 137, 97, 0}, 0) _ , BitConverter.ToInt32(New Byte() {162, 157, 117, 0}, 0), BitConverter.ToInt32(New Byte() {255, 255, 255, 0}, 0) _ , BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0), BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0) _ , BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0), BitConverter.ToInt32(New Byte() {225, 224, 210, 0}, 0) _ , BitConverter.ToInt32(New Byte() {163, 158, 118, 0}, 0), BitConverter.ToInt32(New Byte() {163, 158, 118, 0}, 0) _ , BitConverter.ToInt32(New Byte() {225, 224, 210, 0}, 0), BitConverter.ToInt32(New Byte() {141, 137, 97, 0}, 0) _ , BitConverter.ToInt32(New Byte() {255, 255, 255, 0}, 0), BitConverter.ToInt32(New Byte() {163, 158, 118, 0}, 0) _ , BitConverter.ToInt32(New Byte() {128, 128, 128, 0}, 0), BitConverter.ToInt32(New Byte() {128, 128, 128, 0}, 0) _ , BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0), BitConverter.ToInt32(New Byte() {225, 224, 210, 0}, 0) _ , BitConverter.ToInt32(New Byte() {232, 231, 221, 0}, 0), BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0) _ , BitConverter.ToInt32(New Byte() {255, 255, 255, 0}, 0), BitConverter.ToInt32(New Byte() {128, 0, 0, 0}, 0) _ , BitConverter.ToInt32(New Byte() {225, 224, 210, 0}, 0), BitConverter.ToInt32(New Byte() {159, 155, 115, 0}, 0) _ , BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0), BitConverter.ToInt32(New Byte() {16, 132, 208, 0}, 0) _ , BitConverter.ToInt32(New Byte() {181, 181, 181, 0}, 0) _ } End Function Private Shared Function GetDesert() As Int32() Return New Int32() { _ BitConverter.ToInt32(New Byte() {234, 230, 221, 0}, 0), BitConverter.ToInt32(New Byte() {162, 141, 104, 0}, 0) _ , BitConverter.ToInt32(New Byte() {0, 128, 128, 0}, 0), BitConverter.ToInt32(New Byte() {162, 141, 104, 0}, 0) _ , BitConverter.ToInt32(New Byte() {204, 194, 173, 0}, 0), BitConverter.ToInt32(New Byte() {255, 255, 255, 0}, 0) _ , BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0), BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0) _ , BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0), BitConverter.ToInt32(New Byte() {255, 255, 255, 0}, 0) _ , BitConverter.ToInt32(New Byte() {204, 194, 173, 0}, 0), BitConverter.ToInt32(New Byte() {204, 194, 173, 0}, 0) _ , BitConverter.ToInt32(New Byte() {162, 141, 104, 0}, 0), BitConverter.ToInt32(New Byte() {0, 128, 128, 0}, 0) _ , BitConverter.ToInt32(New Byte() {255, 255, 255, 0}, 0), BitConverter.ToInt32(New Byte() {204, 194, 173, 0}, 0) _ , BitConverter.ToInt32(New Byte() {128, 128, 128, 0}, 0), BitConverter.ToInt32(New Byte() {162, 141, 104, 0}, 0) _ , BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0), BitConverter.ToInt32(New Byte() {255, 255, 255, 0}, 0) _ , BitConverter.ToInt32(New Byte() {234, 230, 221, 0}, 0), BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0) _ , BitConverter.ToInt32(New Byte() {255, 255, 255, 0}, 0), BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0) _ , BitConverter.ToInt32(New Byte() {255, 255, 255, 0}, 0), BitConverter.ToInt32(New Byte() {204, 194, 173, 0}, 0) _ , BitConverter.ToInt32(New Byte() {0, 0, 0, 0}, 0), BitConverter.ToInt32(New Byte() {16, 132, 208, 0}, 0) _ , BitConverter.ToInt32(New Byte() {181, 181, 181, 0}, 0) _ } End Function #End Region #Region "Consts" Private Const SYS_COLOR_INDEX_FLAG As Int32 = &H40000000 Private Const COLOR_SCROLLBAR As Int32 = 0 Or SYS_COLOR_INDEX_FLAG Private Const COLOR_BACKGROUND As Int32 = 1 Or SYS_COLOR_INDEX_FLAG 'COLOR_DESKTOP Private Const COLOR_ACTIVECAPTION As Int32 = 2 Or SYS_COLOR_INDEX_FLAG Private Const COLOR_INACTIVECAPTION As Int32 = 3 Or SYS_COLOR_INDEX_FLAG Private Const COLOR_MENU As Int32 = 4 Or SYS_COLOR_INDEX_FLAG Private Const COLOR_WINDOW As Int32 = 5 Or SYS_COLOR_INDEX_FLAG Private Const COLOR_WINDOWFRAME As Int32 = 6 Or SYS_COLOR_INDEX_FLAG Private Const COLOR_MENUTEXT As Int32 = 7 Or SYS_COLOR_INDEX_FLAG Private Const COLOR_WINDOWTEXT As Int32 = 8 Or SYS_COLOR_INDEX_FLAG Private Const COLOR_CAPTIONTEXT As Int32 = 9 Or SYS_COLOR_INDEX_FLAG Private Const COLOR_ACTIVEBORDER As Int32 = 10 Or SYS_COLOR_INDEX_FLAG Private Const COLOR_INACTIVEBORDER As Int32 = 11 Or SYS_COLOR_INDEX_FLAG Private Const COLOR_APPWORKSPACE As Int32 = 12 Or SYS_COLOR_INDEX_FLAG Private Const COLOR_HIGHLIGHT As Int32 = 13 Or SYS_COLOR_INDEX_FLAG Private Const COLOR_HIGHLIGHTTEXT As Int32 = 14 Or SYS_COLOR_INDEX_FLAG Private Const COLOR_BTNFACE As Int32 = 15 Or SYS_COLOR_INDEX_FLAG 'COLOR_3DFACE Private Const COLOR_BTNSHADOW As Int32 = 16 Or SYS_COLOR_INDEX_FLAG 'COLOR_3DSHADOW Private Const COLOR_GRAYTEXT As Int32 = 17 Or SYS_COLOR_INDEX_FLAG Private Const COLOR_BTNTEXT As Int32 = 18 Or SYS_COLOR_INDEX_FLAG Private Const COLOR_INACTIVECAPTIONTEXT As Int32 = 19 Or SYS_COLOR_INDEX_FLAG Private Const COLOR_BTNHIGHLIGHT As Int32 = 20 Or SYS_COLOR_INDEX_FLAG 'COLOR_3DHIGHLIGHT, COLOR_3DHILIGHT, COLOR_BTNHILIGHT Private Const COLOR_3DDKSHADOW As Int32 = 21 Or SYS_COLOR_INDEX_FLAG Private Const COLOR_3DLIGHT As Int32 = 22 Or SYS_COLOR_INDEX_FLAG Private Const COLOR_INFOTEXT As Int32 = 23 Or SYS_COLOR_INDEX_FLAG Private Const COLOR_INFOBK As Int32 = 24 Or SYS_COLOR_INDEX_FLAG Private Const COLOR_STATIC As Int32 = 25 Or SYS_COLOR_INDEX_FLAG Private Const COLOR_STATICTEXT As Int32 = 26 Or SYS_COLOR_INDEX_FLAG Private Const COLOR_GRADIENTACTIVECAPTION As Int32 = 27 Or SYS_COLOR_INDEX_FLAG Private Const COLOR_GRADIENTINACTIVECAPTION As Int32 = 28 Or SYS_COLOR_INDEX_FLAG #End Region #Region "pinvokes" _ Private Shared Function SetSysColors(ByVal cElements As Int32, ByVal lpaElements As Int32(), ByVal lpaRgbValues As Int32()) As Boolean End Function _ Private Shared Function GetSysColor(ByVal nIndex As Int32) As Int32 End Function #End Region #Region "Properties" Public Shared Property GradientActiveCaption() As Color Get Dim c As Color = ColorTranslator.FromWin32(GetSysColor(COLOR_GRADIENTACTIVECAPTION)) Return c End Get Set(ByVal Value As Color) If SetSysColors(1, New Int32() {COLOR_GRADIENTACTIVECAPTION}, New Int32() {ColorTranslator.ToWin32(Value)}) = False Then Throw New ApplicationException(Marshal.GetLastWin32Error().ToString()) End If End Set End Property Public Shared Property GradientInactiveCaption() As Color Get Dim c As Color = ColorTranslator.FromWin32(GetSysColor(COLOR_GRADIENTINACTIVECAPTION)) Return c End Get Set(ByVal Value As Color) If SetSysColors(1, New Int32() {COLOR_GRADIENTINACTIVECAPTION}, New Int32() {ColorTranslator.ToWin32(Value)}) = False Then Throw New ApplicationException(Marshal.GetLastWin32Error().ToString()) End If End Set End Property Public Shared Property ActiveBorder() As Color Get Dim c As Color = ColorTranslator.FromWin32(GetSysColor(COLOR_ACTIVEBORDER)) Trace.Assert(SystemColors.ActiveBorder.R = c.R AndAlso SystemColors.ActiveBorder.G = c.G AndAlso SystemColors.ActiveBorder.B = c.B AndAlso SystemColors.ActiveBorder.A = c.A) Return c End Get Set(ByVal Value As Color) If SetSysColors(1, New Int32() {COLOR_ACTIVEBORDER}, New Int32() {ColorTranslator.ToWin32(Value)}) = False Then Throw New ApplicationException(Marshal.GetLastWin32Error().ToString()) End If End Set End Property Public Shared Property AppWorkspace() As Color Get Dim c As Color = ColorTranslator.FromWin32(GetSysColor(COLOR_APPWORKSPACE)) Trace.Assert(SystemColors.AppWorkspace.R = c.R AndAlso SystemColors.AppWorkspace.G = c.G AndAlso SystemColors.AppWorkspace.B = c.B AndAlso SystemColors.AppWorkspace.A = c.A) Return c End Get Set(ByVal Value As Color) If SetSysColors(1, New Int32() {COLOR_APPWORKSPACE}, New Int32() {ColorTranslator.ToWin32(Value)}) = False Then Throw New ApplicationException(Marshal.GetLastWin32Error().ToString()) End If End Set End Property Public Shared Property Control() As Color Get Dim c As Color = ColorTranslator.FromWin32(GetSysColor(COLOR_BTNFACE)) Trace.Assert(SystemColors.Control.R = c.R AndAlso SystemColors.Control.G = c.G AndAlso SystemColors.Control.B = c.B AndAlso SystemColors.Control.A = c.A) Return c End Get Set(ByVal Value As Color) If SetSysColors(1, New Int32() {COLOR_BTNFACE}, New Int32() {ColorTranslator.ToWin32(Value)}) = False Then Throw New ApplicationException(Marshal.GetLastWin32Error().ToString()) End If End Set End Property Public Shared Property ControlLight() As Color Get Dim c As Color = ColorTranslator.FromWin32(GetSysColor(COLOR_3DLIGHT)) Trace.Assert(SystemColors.ControlLight.R = c.R AndAlso SystemColors.ControlLight.G = c.G AndAlso SystemColors.ControlLight.B = c.B AndAlso SystemColors.ControlLight.A = c.A) Return c End Get Set(ByVal Value As Color) If SetSysColors(1, New Int32() {COLOR_3DLIGHT}, New Int32() {ColorTranslator.ToWin32(Value)}) = False Then Throw New ApplicationException(Marshal.GetLastWin32Error().ToString()) End If End Set End Property Public Shared Property ControlLightLight() As Color Get Dim c As Color = ColorTranslator.FromWin32(GetSysColor(COLOR_BTNHIGHLIGHT)) Trace.Assert(SystemColors.ControlLightLight.R = c.R AndAlso SystemColors.ControlLightLight.G = c.G AndAlso SystemColors.ControlLightLight.B = c.B AndAlso SystemColors.ControlLightLight.A = c.A) Return c End Get Set(ByVal Value As Color) If SetSysColors(1, New Int32() {COLOR_BTNHIGHLIGHT}, New Int32() {ColorTranslator.ToWin32(Value)}) = False Then Throw New ApplicationException(Marshal.GetLastWin32Error().ToString()) End If End Set End Property Public Shared Property ControlDark() As Color Get Dim c As Color = ColorTranslator.FromWin32(GetSysColor(COLOR_BTNSHADOW)) Trace.Assert(SystemColors.ControlDark.R = c.R AndAlso SystemColors.ControlDark.G = c.G AndAlso SystemColors.ControlDark.B = c.B AndAlso SystemColors.ControlDark.A = c.A) Return c End Get Set(ByVal Value As Color) If SetSysColors(1, New Int32() {COLOR_BTNSHADOW}, New Int32() {ColorTranslator.ToWin32(Value)}) = False Then Throw New ApplicationException(Marshal.GetLastWin32Error().ToString()) End If End Set End Property Public Shared Property ControlDarkDark() As Color Get Dim c As Color = ColorTranslator.FromWin32(GetSysColor(COLOR_3DDKSHADOW)) Trace.Assert(SystemColors.ControlDarkDark.R = c.R AndAlso SystemColors.ControlDarkDark.G = c.G AndAlso SystemColors.ControlDarkDark.B = c.B AndAlso SystemColors.ControlDarkDark.A = c.A) Return c End Get Set(ByVal Value As Color) If SetSysColors(1, New Int32() {COLOR_3DDKSHADOW}, New Int32() {ColorTranslator.ToWin32(Value)}) = False Then Throw New ApplicationException(Marshal.GetLastWin32Error().ToString()) End If End Set End Property Public Shared Property ScrollBar() As Color Get Dim c As Color = ColorTranslator.FromWin32(GetSysColor(COLOR_SCROLLBAR)) Trace.Assert(SystemColors.ScrollBar.R = c.R AndAlso SystemColors.ScrollBar.G = c.G AndAlso SystemColors.ScrollBar.B = c.B AndAlso SystemColors.ScrollBar.A = c.A) Return c End Get Set(ByVal Value As Color) If SetSysColors(1, New Int32() {COLOR_SCROLLBAR}, New Int32() {ColorTranslator.ToWin32(Value)}) = False Then Throw New ApplicationException(Marshal.GetLastWin32Error().ToString()) End If End Set End Property Public Shared Property WindowFrame() As Color Get Dim c As Color = ColorTranslator.FromWin32(GetSysColor(COLOR_WINDOWFRAME)) Trace.Assert(SystemColors.WindowFrame.R = c.R AndAlso SystemColors.WindowFrame.G = c.G AndAlso SystemColors.WindowFrame.B = c.B AndAlso SystemColors.WindowFrame.A = c.A) Return c End Get Set(ByVal Value As Color) If SetSysColors(1, New Int32() {COLOR_WINDOWFRAME}, New Int32() {ColorTranslator.ToWin32(Value)}) = False Then Throw New ApplicationException(Marshal.GetLastWin32Error().ToString()) End If End Set End Property Public Shared Property HotTrack() As Color Get Dim c As Color = DialogBoxText Trace.Assert(SystemColors.HotTrack.R = c.R AndAlso SystemColors.HotTrack.G = c.G AndAlso SystemColors.HotTrack.B = c.B AndAlso SystemColors.HotTrack.A = c.A) Return c End Get Set(ByVal Value As Color) DialogBoxText = Value End Set End Property Public Shared Property InactiveBorder() As Color Get Dim c As Color = ColorTranslator.FromWin32(GetSysColor(COLOR_INACTIVEBORDER)) Trace.Assert(SystemColors.InactiveBorder.R = c.R AndAlso SystemColors.InactiveBorder.G = c.G AndAlso SystemColors.InactiveBorder.B = c.B AndAlso SystemColors.InactiveBorder.A = c.A) Return c End Get Set(ByVal Value As Color) If SetSysColors(1, New Int32() {COLOR_INACTIVEBORDER}, New Int32() {ColorTranslator.ToWin32(Value)}) = False Then Throw New ApplicationException(Marshal.GetLastWin32Error().ToString()) End If End Set End Property Public Shared Property Info() As Color Get Dim c As Color = ColorTranslator.FromWin32(GetSysColor(COLOR_INFOBK)) Trace.Assert(SystemColors.Info.R = c.R AndAlso SystemColors.Info.G = c.G AndAlso SystemColors.Info.B = c.B AndAlso SystemColors.Info.A = c.A) Return c End Get Set(ByVal Value As Color) If SetSysColors(1, New Int32() {COLOR_INFOBK}, New Int32() {ColorTranslator.ToWin32(Value)}) = False Then Throw New ApplicationException(Marshal.GetLastWin32Error().ToString()) End If End Set End Property Public Shared Property InfoText() As Color Get Dim c As Color = ColorTranslator.FromWin32(GetSysColor(COLOR_INFOTEXT)) Trace.Assert(SystemColors.InfoText.R = c.R AndAlso SystemColors.InfoText.G = c.G AndAlso SystemColors.InfoText.B = c.B AndAlso SystemColors.InfoText.A = c.A) Return c End Get Set(ByVal Value As Color) If SetSysColors(1, New Int32() {COLOR_INFOTEXT}, New Int32() {ColorTranslator.ToWin32(Value)}) = False Then Throw New ApplicationException(Marshal.GetLastWin32Error().ToString()) End If End Set End Property ' Active Title Bar Public Shared Property ActiveCaption() As Color Get Dim c As Color = ColorTranslator.FromWin32(GetSysColor(COLOR_ACTIVECAPTION)) Trace.Assert(SystemColors.ActiveCaption.R = c.R AndAlso SystemColors.ActiveCaption.G = c.G AndAlso SystemColors.ActiveCaption.B = c.B AndAlso SystemColors.ActiveCaption.A = c.A) Return c End Get Set(ByVal Value As Color) If SetSysColors(1, New Int32() {COLOR_ACTIVECAPTION}, New Int32() {ColorTranslator.ToWin32(Value)}) = False Then Throw New ApplicationException(Marshal.GetLastWin32Error().ToString()) End If End Set End Property ' Active Title Text Public Shared Property ActiveCaptionText() As Color Get Dim c As Color = ColorTranslator.FromWin32(GetSysColor(COLOR_CAPTIONTEXT)) Trace.Assert(SystemColors.ActiveCaptionText.R = c.R AndAlso SystemColors.ActiveCaptionText.G = c.G AndAlso SystemColors.ActiveCaptionText.B = c.B AndAlso SystemColors.ActiveCaptionText.A = c.A) Return c End Get Set(ByVal Value As Color) If SetSysColors(1, New Int32() {COLOR_CAPTIONTEXT}, New Int32() {ColorTranslator.ToWin32(Value)}) = False Then Throw New ApplicationException(Marshal.GetLastWin32Error().ToString()) End If End Set End Property ' Button Text Public Shared Property ControlText() As Color Get Dim c As Color = ColorTranslator.FromWin32(GetSysColor(COLOR_BTNTEXT)) Trace.Assert(SystemColors.ControlText.R = c.R AndAlso SystemColors.ControlText.G = c.G AndAlso SystemColors.ControlText.B = c.B AndAlso SystemColors.ControlText.A = c.A) Return c End Get Set(ByVal Value As Color) If SetSysColors(1, New Int32() {COLOR_BTNTEXT}, New Int32() {ColorTranslator.ToWin32(Value)}) = False Then Throw New ApplicationException(Marshal.GetLastWin32Error().ToString()) End If End Set End Property Public Shared Property Desktop() As Color Get Dim c As Color = ColorTranslator.FromWin32(GetSysColor(COLOR_BACKGROUND)) Trace.Assert(SystemColors.Desktop.R = c.R AndAlso SystemColors.Desktop.G = c.G AndAlso SystemColors.Desktop.B = c.B AndAlso SystemColors.Desktop.A = c.A) Return c End Get Set(ByVal Value As Color) If SetSysColors(1, New Int32() {COLOR_BACKGROUND}, New Int32() {ColorTranslator.ToWin32(Value)}) = False Then Throw New ApplicationException(Marshal.GetLastWin32Error().ToString()) End If End Set End Property Public Shared Property DialogBackground() As Color Get Dim c As Color = ColorTranslator.FromWin32(GetSysColor(COLOR_STATIC)) Return c End Get Set(ByVal Value As Color) If SetSysColors(1, New Int32() {COLOR_STATIC}, New Int32() {ColorTranslator.ToWin32(Value)}) = False Then Throw New ApplicationException(Marshal.GetLastWin32Error().ToString()) End If End Set End Property Public Shared Property DialogBoxText() As Color Get Dim c As Color = ColorTranslator.FromWin32(GetSysColor(COLOR_STATICTEXT)) Return c End Get Set(ByVal Value As Color) If SetSysColors(1, New Int32() {COLOR_STATICTEXT}, New Int32() {ColorTranslator.ToWin32(Value)}) = False Then Throw New ApplicationException(Marshal.GetLastWin32Error().ToString()) End If End Set End Property ' Disabled Text Public Shared Property GrayText() As Color Get Dim c As Color = ColorTranslator.FromWin32(GetSysColor(COLOR_GRAYTEXT)) Trace.Assert(SystemColors.GrayText.R = c.R AndAlso SystemColors.GrayText.G = c.G AndAlso SystemColors.GrayText.B = c.B AndAlso SystemColors.GrayText.A = c.A) Return c End Get Set(ByVal Value As Color) If SetSysColors(1, New Int32() {COLOR_GRAYTEXT}, New Int32() {ColorTranslator.ToWin32(Value)}) = False Then Throw New ApplicationException(Marshal.GetLastWin32Error().ToString()) End If End Set End Property ' Inactive Title Bar Public Shared Property InactiveCaption() As Color Get Dim c As Color = ColorTranslator.FromWin32(GetSysColor(COLOR_INACTIVECAPTION)) Trace.Assert(SystemColors.InactiveCaption.R = c.R AndAlso SystemColors.InactiveCaption.G = c.G AndAlso SystemColors.InactiveCaption.B = c.B AndAlso SystemColors.InactiveCaption.A = c.A) Return c End Get Set(ByVal Value As Color) If SetSysColors(1, New Int32() {COLOR_INACTIVECAPTION}, New Int32() {ColorTranslator.ToWin32(Value)}) = False Then Throw New ApplicationException(Marshal.GetLastWin32Error().ToString()) End If End Set End Property ' Inactive Title text Public Shared Property InactiveCaptionText() As Color Get Dim c As Color = ColorTranslator.FromWin32(GetSysColor(COLOR_INACTIVECAPTIONTEXT)) Trace.Assert(SystemColors.InactiveCaptionText.R = c.R AndAlso SystemColors.InactiveCaptionText.G = c.G AndAlso SystemColors.InactiveCaptionText.B = c.B AndAlso SystemColors.InactiveCaptionText.A = c.A) Return c End Get Set(ByVal Value As Color) If SetSysColors(1, New Int32() {COLOR_INACTIVECAPTIONTEXT}, New Int32() {ColorTranslator.ToWin32(Value)}) = False Then Throw New ApplicationException(Marshal.GetLastWin32Error().ToString()) End If End Set End Property ' Menu Background Public Shared Property Menu() As Color Get Dim c As Color = ColorTranslator.FromWin32(GetSysColor(COLOR_MENU)) Trace.Assert(SystemColors.Menu.R = c.R AndAlso SystemColors.Menu.G = c.G AndAlso SystemColors.Menu.B = c.B AndAlso SystemColors.Menu.A = c.A) Return c End Get Set(ByVal Value As Color) If SetSysColors(1, New Int32() {COLOR_MENU}, New Int32() {ColorTranslator.ToWin32(Value)}) = False Then Throw New ApplicationException(Marshal.GetLastWin32Error().ToString()) End If End Set End Property Public Shared Property MenuText() As Color Get Dim c As Color = ColorTranslator.FromWin32(GetSysColor(COLOR_MENUTEXT)) Trace.Assert(SystemColors.MenuText.R = c.R AndAlso SystemColors.MenuText.G = c.G AndAlso SystemColors.MenuText.B = c.B AndAlso SystemColors.MenuText.A = c.A) Return c End Get Set(ByVal Value As Color) If SetSysColors(1, New Int32() {COLOR_MENUTEXT}, New Int32() {ColorTranslator.ToWin32(Value)}) = False Then Throw New ApplicationException(Marshal.GetLastWin32Error().ToString()) End If End Set End Property ' Selected Items Public Shared Property Highlight() As Color Get Dim c As Color = ColorTranslator.FromWin32(GetSysColor(COLOR_HIGHLIGHT)) Trace.Assert(SystemColors.Highlight.R = c.R AndAlso SystemColors.Highlight.G = c.G AndAlso SystemColors.Highlight.B = c.B AndAlso SystemColors.Highlight.A = c.A) Return c End Get Set(ByVal Value As Color) If SetSysColors(1, New Int32() {COLOR_HIGHLIGHT}, New Int32() {ColorTranslator.ToWin32(Value)}) = False Then Throw New ApplicationException(Marshal.GetLastWin32Error().ToString()) End If End Set End Property ' Selected items text Public Shared Property HighlightText() As Color Get Dim c As Color = ColorTranslator.FromWin32(GetSysColor(COLOR_HIGHLIGHTTEXT)) Trace.Assert(SystemColors.HighlightText.R = c.R AndAlso SystemColors.HighlightText.G = c.G AndAlso SystemColors.HighlightText.B = c.B AndAlso SystemColors.HighlightText.A = c.A) Return c End Get Set(ByVal Value As Color) If SetSysColors(1, New Int32() {COLOR_HIGHLIGHTTEXT}, New Int32() {ColorTranslator.ToWin32(Value)}) = False Then Throw New ApplicationException(Marshal.GetLastWin32Error().ToString()) End If End Set End Property ' Window Background Public Shared Property Window() As Color Get Dim c As Color = ColorTranslator.FromWin32(GetSysColor(COLOR_WINDOW)) Trace.Assert(SystemColors.Window.R = c.R AndAlso SystemColors.Window.G = c.G AndAlso SystemColors.Window.B = c.B AndAlso SystemColors.Window.A = c.A) Return c End Get Set(ByVal Value As Color) If SetSysColors(1, New Int32() {COLOR_WINDOW}, New Int32() {ColorTranslator.ToWin32(Value)}) = False Then Throw New ApplicationException(Marshal.GetLastWin32Error().ToString()) End If End Set End Property Public Shared Property WindowText() As Color Get Dim c As Color = ColorTranslator.FromWin32(GetSysColor(COLOR_WINDOWTEXT)) Trace.Assert(SystemColors.WindowText.R = c.R AndAlso SystemColors.WindowText.G = c.G AndAlso SystemColors.WindowText.B = c.B AndAlso SystemColors.WindowText.A = c.A) Return c End Get Set(ByVal Value As Color) If SetSysColors(1, New Int32() {COLOR_WINDOWTEXT}, New Int32() {ColorTranslator.ToWin32(Value)}) = False Then Throw New ApplicationException(Marshal.GetLastWin32Error().ToString()) End If End Set End Property #End Region Private Sub New() End Sub End Class Public Class ColorTranslator Public Shared Function ToWin32(ByVal Value As Color) As Integer Return ((Value.R Or (Value.G << 8)) Or (Value.B << 16)) End Function Public Shared Function FromWin32(ByVal Value As Integer) As Color Return Color.FromArgb((Value And &HFF), ((Value And &HFF00) >> 8), ((Value And &HFF0000) >> 16)) End Function End Class End Namespace