private void GetThemeColors()
{
int EPB_HEADERBACKGROUND = 1;
int EPB_NORMALGROUPBACKGROUND = 5;
int TMT_GRADIENTCOLOR1 = 3810;
int TMT_GRADIENTCOLOR2 = 3811;
Color selectColor = new Color();
Color focusColor = new Color();
Color borderColor = new Color();
bool useSystemColors = false;
// Check if themes are available
if (m_themeManager._IsAppThemed())
{
if (m_theme!=IntPtr.Zero)
m_themeManager._CloseThemeData(m_theme);
// Open themes for "ExplorerBar"
m_theme = m_themeManager._OpenThemeData(this.Handle,"EXPLORERBAR");
if (m_theme!=IntPtr.Zero)
{
// Get Theme colors..
selectColor = m_themeManager._GetThemeColor(m_theme,EPB_HEADERBACKGROUND,1,TMT_GRADIENTCOLOR2);
focusColor = m_themeManager._GetThemeColor(m_theme,EPB_NORMALGROUPBACKGROUND,1,TMT_GRADIENTCOLOR1);
borderColor = ControlPaint.Light(selectColor);
selectColor = ControlPaint.LightLight(selectColor);
focusColor = ControlPaint.LightLight(selectColor);
}
else
{
useSystemColors = true;
}
}
else
{
useSystemColors = true;
}
if (useSystemColors)
{
// Get System colors
selectColor = SystemColors.ActiveCaption;
focusColor = ControlPaint.Light(selectColor);
borderColor = SystemColors.ActiveBorder;
}
// apply colors..
ItemColors.SelectedBorder = ControlPaint.Light(ControlPaint.Dark(selectColor));
this.BorderColor = borderColor;
ItemColors.Divider = borderColor;
ItemColors.SelectedBackground = selectColor;
ItemColors.FocusBackground = focusColor;
ItemColors.FocusBorder = selectColor;
Invalidate();
}