Re: Problem with Themes -- drawing a rebar

nospam_at_baesman.net
Date: 02/22/05


Date: 22 Feb 2005 12:02:54 -0800

Passing this solution along after dialoging with Mr. Wheatley offline.
Thanks to whoever came up with it. Saved me a lot of grief.

Appears the use of parts in themes isn't very well documented, (go
figure). If you try to draw any of the document subcomponents of a
Rebar (e.g. RP_BAND, RP_GRIPPER, etc), they'll paint mostly
transparent, since it's expected that the background of the entire
rebar may span several of these components.

So, to get the actual Rebars background gradient to draw, you'd do
this:

Theme=OpenThemeData(hwnd, L"Rebar");
DrawThemeBackground(Theme, hdc, -1, 0, &rcW, &rcC)); // -1 for rebar
bkgnd

Note we replaced the RP_BAND constant with -1, (or any integer that
isn't one of the documented constants). Doing this feels a little odd
since it isn't really documented in MSDN, but it appears to get the job
done.

Now just be careful because the gradient you draw in themes like Luna
will change in both the x & y directions within the rect defined by
rcW. If you're trying to draw a gradient to implement some form of
transparency in an owner-drawn control that sits inside a larger rebar,
you'll need to make your rcW match the position of your larger parent,
and then use the rcC clipping rect to just draw the portion of your own
control you want to draw within that larger gradient.

- Robert B.

Rob Wheatley wrote:
> Hi.
>
> I am trying to draw the background gradient of a rebar using the
Windows
> XP visual styles.
>
> I am using:
> Theme=OpenThemeData(hwnd, L"Rebar");
> DrawThemeBackground(Theme, hdc, RP_BAND, 0, &rcW, &rcC));
>
> However, nothing gets drawn. I can draw other objects, such as
window
> captions, so I know that themes are availalbe to the application.
>
> I have no ideal how to solve this problem. Any suggestions would be
> greatly appreciated.
>
> Rob Wheatley
> wheatley@shaw.ca


Quantcast