unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;
type
TForm1 =
class(TForm)
Image1: TImage;
Image2: TImage;
Image3: TImage;
Images1: TImage;
Images2: TImage;
Images3: TImage;
procedure AllButtons(Sender: TObject);
procedure AllMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure AllMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure FormCreate(Sender: TObject);
private
{ Private-Deklarationen }
Labels :
array[1..3]
of TLabel;
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.AllButtons(Sender: TObject);
var
itag:
String;
begin
itag := IntToStr((Sender
as TImage).Tag);
Showmessage(itag)
end;
procedure TForm1.AllMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var
itag:
String;
begin
iTag := IntToStr((Sender
as TImage).Tag);
(FindComponent('
Image'+(iTag))
as TImage).Picture.LoadFromFile(ExtractFilePath(ParamStr(0)) + '
\1u.bmp' );
end;
procedure TForm1.AllMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var
itag:
String;
begin
iTag := IntToStr((Sender
as TImage).Tag);
(FindComponent('
Image'+(iTag))
as TImage).Picture.LoadFromFile(ExtractFilePath(ParamStr(0)) + '
\1.bmp' );
end;
procedure TForm1.FormCreate(Sender: TObject);
var i :integer;
istring :
string;
begin
for i := 1
to 3
do
begin
istring:=IntToStr(i);
Labels[i] := TLabel.Create(self);
Labels[i].Parent := self;
Labels[i].AutoSize:= False;
Labels[i].Transparent:= True;
Labels[i].Width:=(FindComponent('
Images'+(istring))
as TImage).Width;
Labels[i].Height:=(FindComponent('
Images'+(istring))
as TImage).Height;
Labels[i].Top:=(FindComponent('
Images'+(istring))
as TImage).Top;
Labels[i].Left:=(FindComponent('
Images'+(istring))
as TImage).Left;
Labels[i].Layout:=tlCenter;
Labels[i].Alignment:=taCenter;
Labels[i].font.color:=CLWhite;
Labels[i].font.charset:=Ansi_Charset;
Labels[i].font.Size:=8;
Labels[i].BringToFront;
Labels[i].Caption:='
1';
end;
Labels[1].OnClick:=image1.OnClick;
Labels[1].OnMouseDown:=Image1.OnMouseDown;
Labels[1].OnMouseUp:=Image1.OnMouseUp;
end;
end.