RE: How to use UXTHEME.LIB
Hi Gary,
I am near to solving the problem. My current path towards a solution is:
I have subclassed the CView descendent window which is pane 1 of the
splitter wnd, and whose scrollbars do not want to paint with themes. I am
doing this because before this, I could obtain the light blue color on the
scrollbar's parts by clicking on the scrollbar. The scrollbar was themeless
in color until I clicked it. Then the part I clicked becomes "themed" only to
loose its themed color upon resizing or just placing another application in
front of it and then making my application the foreground app again.
Thus I thought I needed to repaint the non-client area of the window and
thus thought subclassing it would be my way out. Unfortunately I don't get
full drawing of the scrollbars (e.g. no arrows).
The only message I capture in my windowproc replacement is NCPAINT and I am
probably not implementing this message correctly. This is my windowproc for
my problematic view:
----------
static WNDPROC OriginalViewWndProc;
LRESULT CALLBACK ViewWindowProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM
lParam )
{
switch( uMsg )
{
case WM_NCPAINT:
{
TRACE( _T("Got WM_ - view wnd\n"));
HDC hdc = ::GetDCEx(hwnd, (HRGN)wParam, DCX_WINDOW | DCX_INTERSECTRGN);
RECT rcClient;
//RECT* prcPaint = &rcClient;
::GetClientRect(hwnd, &rcClient);
HTHEME _hTheme = g_xpStyle.OpenThemeData(hwnd, L"SCROLLBAR");
if (_hTheme)
{
RECT contentRect;
for(int part = SBP_ARROWBTN; part <= SBP_SIZEBOX; part++)
{
g_xpStyle.GetThemeBackgroundContentRect(_hTheme, hdc, part,0,
&rcClient, &contentRect);
if (g_xpStyle.IsThemeBackgroundPartiallyTransparent(_hTheme, part, 0))
{
g_xpStyle.DrawThemeParentBackground(hwnd, hdc, &contentRect);
}
g_xpStyle.DrawThemeBackground(_hTheme,
hdc,
part,
0,
&contentRect, //rcClient,
&contentRect);
}
}
::ReleaseDC(hwnd, hdc);
g_xpStyle.CloseThemeData(_hTheme);
}
return 1; // did nc paint
case WM_PAINT:
::SendMessage(hwnd, WM_NCPAINT,1,0); // and proceed
default:
return ::CallWindowProc(OriginalViewWndProc, hwnd, uMsg, wParam, lParam);
}
}
----------
Thanks!
Thanks in advance,
Juan Dent, M.Sc.
""Gary Chang[MSFT]"" wrote:
Hi Juan,
I have a splitter wnd whose scrollbars do not
want to paint light blue (i.e. according to theme) .
What is the least I need to do to make this wnd themed?
Would you please provide more detailed information about the scenario?
How about your splitter wnd class? Is there anything customized?
Based on your description, only those scrollbars do not have the visual
style in your application?
Thanks!
Best regards,
Gary Chang
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.