unit AppManager;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, ExtCtrls, IniFiles, Spin, Menus, TypeDef;
type
TImage =
class(ExtCtrls.TImage)
private
FOnMouseEnter: TNotifyEvent;
FOnMouseLeave: TNotifyEvent;
procedure CMMouseEnter(
var Msg: TMessage);
message CM_MOUSEENTER;
procedure CMMouseLeave(
var Msg: TMessage);
message CM_MOUSELEAVE;
public
property OnMouseEnter: TNotifyEvent
read FOnMouseEnter
write FOnMouseEnter;
property OnMouseLeave: TNotifyEvent
read FOnMouseLeave
write FOnMouseLeave;
end;
TForm1 =
class(TForm)
procedure MapNVisu;
private
{ Private declarations }
procedure DoOnEnter(Sender: TObject);
procedure DoOnLeave(Sender: TObject);
public
{ Public declarations }
end;
var
Form1 : TForm1;
ProgTupels :
array of array of TProgTupel_type;
implementation
{$R *.dfm}
procedure TImage.CMMouseEnter(
var Msg: TMessage);
begin
if Assigned(FOnMouseEnter)
then
FOnMouseEnter(self);
Msg.Result := 0;
end;
procedure TImage.CMMouseLeave(
var Msg: TMessage);
begin
if Assigned(FOnMouseLeave)
then
FOnMouseLeave(self);
Msg.Result := 0;
end;
procedure TForm1.DoOnEnter(Sender: TObject);
var SenderName :
string;
begin
//dosomething
end;
procedure TForm1.DoOnLeave(Sender: TObject);
var SenderName :
string;
begin
//dosomething
end;
procedure TForm1.MapNVisu;
var r, c : Integer;
begin
for r := 1
to 10
do
begin
for c := 1
to 10
do
begin
ProgTupels[r][c].Icon := TImage.Create(Form1);
ProgTupels[r][c].Icon.Parent := Self;
ProgTupels[r][c].Icon.OnMouseEnter := DoOnEnter;
ProgTupels[r][c].Icon.OnMouseLeave := DoOnLeave;
end;
end;
end;
end.