Visual Styles For Toolbar

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I'm working on a custom control which I'd like to have a background
identical to that of the XP-themed explorer toolbar. Could anyone tell me
which class of the VisualStyles hierarchy contains that look?

VisualStyleElement.ToolBar seems to have only controls and separators, and
VisualStyleElement.Rebar.Band used with DrawBackground doesn't work either.

I've tried using a linear gradient, but the ReBar.Band renderer doesn't seem
to provide the right colors with GetColor.

I've managed to get renders to work for other elements, so I guess I have
some basic knowledge of how to use and initialize them.

Thanks.
 
Hi euphilos,

Thanks for your post.

I am not sure what look does your "XP-themed explorer toolbar background"
refer to, in my machine, if I enable XP theme, I can not see any special
look in toolbar background in Windows Explorer window. Can you provided a
screen shoot regarding the look? Then I can understand your requirement
much better. Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
"Jeffrey Tan[MSFT]" said:
I am not sure what look does your "XP-themed explorer toolbar background"
refer to, in my machine, if I enable XP theme, I can not see any special
look in toolbar background in Windows Explorer window. Can you provided a
screen shoot regarding the look? Then I can understand your requirement
much better.

There seems to be a gradient in the background in Windows XP's default style
(visual styles enabled).
 
Hi Herfried,

I have tried to enable XP theme again, however, I still can not see any
gradient background in normal explorer window. After reviewing all the
windows in the system, I only see gradient background effect in VS2005
toolbar, also in VS2005 ToolStrip control.(event VS.net2003 toolbar control
does not have such effect). So I think VS2005 ToolStrip control draws the
gradient background effect himself.

More specificly, ToolStrip uses
ToolStripProfessionalRenderer.RenderToolStripBackgroundInternal method to
draw the background:
private void RenderToolStripBackgroundInternal(ToolStripRenderEventArgs e)
{
ToolStrip strip1 = e.ToolStrip;
Graphics graphics1 = e.Graphics;
Rectangle rectangle1 = new Rectangle(Point.Empty, e.ToolStrip.Size);
LinearGradientMode mode1 = (strip1.Orientation ==
Orientation.Horizontal) ? LinearGradientMode.Vertical :
LinearGradientMode.Horizontal;
this.FillWithDoubleGradient(this.ColorTable.ToolStripGradientBegin,
this.ColorTable.ToolStripGradientMiddle,
this.ColorTable.ToolStripGradientEnd, e.Graphics, rectangle1, 12, 12,
mode1, false);
}

Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Hello Jeffrey,

Here is a link to an image showing the toolbar with XP themes enabled.

http://www.docuverse.com/visualspoof/secureui2.gif

You can see both in the outer window (having silver theme) and in the inner
window (having the default blue theme) that the toolbar has a gradient
starting from a light color at the left and turning into a darker color at
the right. In the first case the colors are a light yellow gray to a darker
blue gray, and in the second case about the same start color, but turning
into a darker shade of yellow gray (the colors are pastel-like, not
saturated).

I would like the same effect, because the contol I'm developing will be
integrated into the explorer and I would like to give it a consistent look.

As I said initially, I've tried the gradient approach too, but I need to
know the exact colors (they are not in SystemColors either). There should be
a visual style element class which has either the colors or the background
definition for this, so I can use the visual style renderer.

If anyone knows which one it is, or can point me to some more detailed
documentation of the visual style elements I'd appreciate it.

Thanks.
 
Hi euphilos,

Thanks for your feedback.

Sorry, I am not sure what's wrong. Actually, I can not see such great
gradient in both outer window and inner window toolbars in the screen shoot
image. I can not see any darker blue gray in the background.

If anyone in the community can see the greate gradient in the image, please
feel free to tell me, thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
You may use style "Rebar" with part and state equal to zero. For some reasons
Microsoft was not add VisualStyleElement for this. However, you can create
renderer with these parameters by your self:

new VisualStyleRenderer("Rebar", 0, 0);

With this renderer, you will be able to render nice IE Rebar background :).
Other thing is that this element was not defined by Microsoft can mean that
it obsolete. In this way, you need to keep this in mind.

Additionally some time ago I was developing Rebar Tool Strip Renderer. You
can found useful code in it. Please refer to the
http://www.chaliy.com/Sources/RebarRenderer/.

Hope this will help.
 
Back
Top