fibdev
asked on
Toolbar Image swap on mouseover
How do I swap an image when the mouse pointer is over a toolbar button?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks again Alex,
You the man
You the man
Anytime, fibdev. ;)
Alex
Alex
You install the component TSQWToolButton.
Second.
When you new a Toolbutton then view the Form as Text , Change the ToolButton into TSQWToolButton. If you do that , then you can use the events OnMouseEnter and OnMouseLeave and you can change the Image of the ToolButton.
Good Luck!
shenqw
//TSQWToolButton Component
unit SQWToolButton;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ComCtrls;
type
TSQWToolButton = class(TToolButton)
private
{ Private declarations }
FOnMouseEnter,
FOnMouseLeave:TNotifyEvent
protected
{ Protected declarations }
procedure CMMouseEnter(var Message:TMessage);message CM_MOUSEENTER;
procedure CMMouseLeave(var Message:TMessage);message CM_MOUSELEAVE;
public
{ Public declarations }
published
{ Published declarations }
property OnMouseEnter:TNotifyEvent read FOnMouseEnter write FOnMouseEnter;
property OnMouseLeave:TNotifyEvent read FOnMouseLeave write FOnMouseLeave;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Sample
end;
{ TSQWToolButton }
procedure TSQWToolButton.CMMouseEnte
begin
inherited;
if Assigned(FOnMouseEnter) then FOnMouseEnter(Self);
end;
procedure TSQWToolButton.CMMouseLeav
begin
inherited;
if Assigned(FOnMouseLeave) then FOnMouseLeave(Self);
end;
end.