In etwa so:
Delphi-Quellcode:
type
TForm1 = class(TForm)
Image1: TImage; // Das Image was schon auf der Form liegt
//...
private
{ Private-Deklarationen }
procedure CMMouseEnter(var Msg: TMessage); message CM_MOUSEENTER;
procedure CMMouseLeave(var Msg: TMessage); message CM_MOUSELEAVE;
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.CMMouseEnter(var Msg: TMessage);
var
aComponent: TComponent;
begin
aComponent := TComponent(Msg.LParam);
if (aComponent = Image1) then
begin
Image1.Picture.LoadFromFile('...');
end;
end;
procedure TForm1.CMMouseLeave(var Msg: TMessage);
var
aComponent: TComponent;
begin
aComponent := TComponent(Msg.LParam);
if (aComponent = Image1) then
begin
Image1.Picture.LoadFromFile('...');
end;
end;
War das nicht schon mal irgend wo hier in der
DP erleutert ?