Managing Images in a Toolbar

Managing Images in a Toolbar

I’ve created a toolbar for an MDI app using a top-aligned panel and a number of image controls. When the user clicks on an “up” image, the image picture is replaced by a “down” picture. I then have code in the image Mouse_Move event so that if the mouse is dragged (button is down) off the image, the “down” picture is replaced by the “up” picture. Trouble is, if the user is dragging from the MDI area and passes over the image, the “down” image is shown (non-standard Windows behavior) and is then left in place when the user drags away from the image. The ugly result is a toolbar button that appears stuck in the down position.

What about setting a flag in the Mouse_Down event that would stay set until the MouseUp event happens? That way, in the MouseMove event you could see if the user had actually pressed the button or was just passing over it.

You might also want to try using one of the many shareware/freeware controls to do toolbars. It’s much easier than doing it manually.In VB4.0 there is a control included for Toolbars as well as one for Statusbars.


Share the Post: