I'm playing around with drawing my own custom controls using the uxTheme library in Windows, and I can't work out why my control doesn't look like the regular Windows control that (supposedly) uses the same theme I'm using:
The above image shows a standard Windows ComboBox (top) and my custom control drawn using the ComboBox theme (bottom). What I can't work out is why the border from my control is a different shape and colour to the standard control.
In my class constructor I open the theme data:
mComboTheme = OpenThemeData( hwnd, L"COMBOBOX" );
And then in the handler for WM_PAINT I'm just drawing two parts of the ComboBox components:
case WM_PAINT:
{
PAINTSTRUCT ps;
HDC hdc;
RECT client;
if( GetUpdateRect( hwnd, &ps.rcPaint, false ))
{
hdc = BeginPaint( hwnd, &ps );
GetClientRect( hwnd, &client );
if( IsThemeBackgroundPartiallyTransparent( mComboTheme, CP_BACKGROUND, CBXS_HOT ))
{
DrawThemeParentBackground( hwnd, hdc, &ps.rcPaint );
}
DrawThemeBackground( mComboTheme, hdc, CP_BACKGROUND, CBXS_HOT, &client, &ps.rcPaint );
client.left = client.right - 20;
DrawThemeBackground( mComboTheme, hdc, CP_DROPDOWNBUTTONRIGHT, CBXSR_HOT, &client, ps.rcPaint );
EndPaint( *this, &ps );
}
break;
}
Any suggestions as to why these two controls don't look the same would be greatly appreciated.
Thanks,
James