The new vbAccelerator Site - more VB and .NET Code and Controls
Source Code
2 Common Controls Library &nbsp
&nbsp

Hosting a Toolbar Ouside the Rebar

Toolbar hosted outside a rebar

Download the Toolbar Hosting Demonstration (66kb)

&nbsp Before you Begin &nbsp
&nbsp This project requires the vbAccelerator CoolMenu Toolbar and Rebar Control. Make sure you have loaded and registered this before trying the project. &nbsp
&nbsp This project requires the SSubTmr.DLL component. Make sure you have loaded and registered this before trying the project. &nbsp

This project demonstrates how to host a vbAccelerator Toolbar control outside a Rebar. Whilst you don't have to add a toolbar to a rebar, you will find that the toolbar only draws correctly outside if it doesn't have flat buttons:

Disaster!
Comment-on dit "Display Bug "?

The problem is that a flat toolbar has a specialised drawing routine to allow it to draw transparently. It sends a WM_ERASEBKGND message whenever it wants its own backdrop to be redrawn. If the host of the toolbar doesn't respond to this, the background is never updated and you get to see whatever was behind the toolbar at the time, as you can see from the picture above!

This is easily solved using the inbuilt Toolbar Host control. This control subclasses the WM_ERASEBKGND message and in response clears its own background. In addition to this, it also includes automatic resizing code suitable for building wrappable toolbar displays, and can accept other VB controls too, such two additional combo boxes in this demo. The code also demonstrates how to set up the revolting tangerine coloured background to the control as shown in the picture!




Back to top

Back to Source Code

&nbsp
 

About  Contribute  Send Feedback  Privacy

Copyright © 1998-1999, Steve McMahon ( steve@vbaccelerator.com). All Rights Reserved.
Last updated: 30 May 1999