unit FensterDeckbuilder;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, IniFiles, jpeg;
type
TForm3 =
class(TForm)
ButtonBeenden: TButton;
Label1: TLabel;
Image1: TImage;
Button1: TButton;
procedure ButtonBeendenClick(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure DefineKarte;
procedure NeueKarte;
procedure MouseOverKarte;
procedure ImageOnClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form3: TForm3;
ini: TIniFile;
JPEG: TJpegImage;
BMP:TBitmap;
MouseStartPos : TPoint;
Down : Boolean = False;
MousOverKarte: Boolean = False;
xdifferenz, ydifferenz: integer;
xpos: integer = 200;
ypos: integer = 100;
breite: integer = 100;
k: integer = 0;
maxKarten: integer = 120;
ArrayExist:
array of Boolean;
ArrayBild:
array of TImage;
ArrayBildx:
array of integer;
ArrayBildy:
array of integer;
implementation
{$R *.dfm}
procedure TForm3.ImageOnClick(Sender: TObject);
begin
Label1.Caption := InttoStr(k);
end;
{
ArrayBild[1].OnClick := ImageOnClick;
}
procedure TForm3.DefineKarte;
begin
k := 0;
while k<maxKarten
do
begin
ArrayExist[k] := False;
k := k + 1;
end;
end;
procedure TForm3.NeueKarte;
begin
k:=0;
repeat
k:=k+1;
until ArrayExist[k]=False;
ArrayExist[k] := True;
ArrayBild[k] := timage.Create(Form3);
ArrayBild[k].parent := Form3;
ArrayBild[k].Stretch := True;
ArrayBild[k].Transparent := True;
ArrayBild[k].Picture.LoadFromFile(ExtractFilePath(ParamStr(0))+'
Bilder\Jareth, der Löwentitan.jpg');
ArrayBild[k].Left := xpos+k*10;
ArrayBild[k].Top := ypos+k*10;
ArrayBild[k].Width := breite;
ArrayBild[k].Height := Round(breite*1.39);
ArrayBild[k].Visible := True;
end;
procedure TForm3.MouseOverKarte;
begin
k:=0;
MousOverKarte:=False;
while ((MousOverKarte=False)
and (k<maxkarten))
do
begin
if (ArrayBild[k].Left<MouseStartPos.X)
and (MouseStartPos.X<(ArrayBild[k].Left+breite))
then
begin
if (ArrayBild[k].Top<MouseStartPos.Y)
and (MouseStartPos.Y<(ArrayBild[k].Top+Round(breite*1.39)))
then
begin
xdifferenz:=MouseStartPos.X-ArrayBild[k].Left;
ydifferenz:=MouseStartPos.Y-ArrayBild[k].Top;
Down := True;
MousOverKarte := True;
end;
end;
if MousOverKarte=False
then k := k + 1;
end;
end;
procedure TForm3.FormActivate(Sender: TObject);
begin
ini:=TIniFile.create(ExtractFilePath(ParamStr(0))+'
einstellungen.ini');
try
JPEG:=TJpegImage.Create;
// JPEG erzeugen
BMP:=TBitmap.Create;
// BMP erzeugen
JPEG.LoadFromFile(ExtractFilePath(ParamStr(0))+'
Bilder\'+ini.ReadString('
Profil','
Thema','
Standard')+'
\main.jpg');
BMP.Assign(JPEG);
Image1.Picture.Bitmap:=BMP;
Image1.SendToBack;
finally
ini.free;
end;
SetLength(ArrayExist, maxKarten);
SetLength(ArrayBild, maxKarten);
SetLength(ArrayBildx, maxKarten);
SetLength(ArrayBildy, maxKarten);
DefineKarte;
end;
procedure TForm3.Button1Click(Sender: TObject);
begin
NeueKarte;
end;
procedure TForm3.ButtonBeendenClick(Sender: TObject);
begin
Close;
end;
end.