Does anyone know how to determine the windows xp color scheme at runtime I need to know if the user is using blue, silver, or olive to customize a control based on their color scheme...
<DllImport("uxtheme", CharSet:=CharSet.Unicode, CallingConvention:=CallingConvention.Cdecl)> _ Private Shared Function GetCurrentThemeName( _ ByVal pszThemeFileName As StringBuilder, _ ByVal cchMaxNameChars As Integer, _ ByVal pszColorBuff As StringBuilder, _ ByVal cchMaxColorChars As Integer, _ ByVal pszSizeBuff As StringBuilder, _ ByVal cchMaxSizeChars As Integer) As Integer End Function
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim sb As New StringBuilder(255) GetCurrentThemeName(Nothing, Nothing, sb, 255, Nothing, Nothing) MsgBox(sb.ToString) End Sub
NormalColor = Blue HomeStead = Olive Mettalic = Silver
Thanks for the post, yeah I know that they user can customize their colors, the safest thing would be to determine what their system colors are and customize the control based on that. This gives me the start that I'm looking for though...
How to determine Windows XP Color Scheme
Amrish Deep Ravidas
The following vb.net code will do what you ask.
Imports System.Runtime.InteropServices
Imports System.Text
<DllImport("uxtheme", CharSet:=CharSet.Unicode, CallingConvention:=CallingConvention.Cdecl)> _
Private Shared Function GetCurrentThemeName( _
ByVal pszThemeFileName As StringBuilder, _
ByVal cchMaxNameChars As Integer, _
ByVal pszColorBuff As StringBuilder, _
ByVal cchMaxColorChars As Integer, _
ByVal pszSizeBuff As StringBuilder, _
ByVal cchMaxSizeChars As Integer) As Integer
End Function
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim sb As New StringBuilder(255)
GetCurrentThemeName(Nothing, Nothing, sb, 255, Nothing, Nothing)
MsgBox(sb.ToString)
End Sub
NormalColor = Blue
HomeStead = Olive
Mettalic = Silver
Bubba_WGU
http://msdn.microsoft.com/library/en-us/shellcc/platform/commctls/userex/functions/getthemecolor.asp frame=true
In Windows Forms 2005, this will be offered via the VisualStyles api.
ubsman
Thanks for the post, yeah I know that they user can customize their colors, the safest thing would be to determine what their system colors are and customize the control based on that. This gives me the start that I'm looking for though...
Anthony