Re: Problem with Themes -- drawing a rebar

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

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



Relevant Pages

  • Neon Lines
    ... things with the .net drawing functions, but this one has me stumped. ... I want to draw neon lines. ... Now I can draw a straight line with a gradient ... To achieve a basic neon effect a gradient of dark-light-dark is used, ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: How to draw a rectangle with gradient?
    ... I am using PIL to draw a rectangle filled with color blue. ... Is there anyway I could set the fill pattern so that the drawn ... I don't think there is a built-in gradient function, ...
    (comp.lang.python)
  • Re: Applying color to Toolbars
    ... Now I'm able to draw a gradient "backcolor". ... > GradientToolbar, which inherrits from Toolbar. ... >> protected override void OnPaint ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: Drawing a circular gradient
    ... linear gradient, changing the start and end color a bit each time. ... Animated vector graphics system ... > I want to draw a gradient, much like the gradient drawn by a linear ... > to be able to specify 2 colors and have the gradient drawn like in the ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: Applying color to Toolbars
    ... "Tonny" wrote in message ... > I'm trying to draw an gradient on a Toolbar. ... > GradientToolbar, which inherrits from Toolbar. ...
    (microsoft.public.dotnet.framework.drawing)