unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, jpeg, XPMan, StdCtrls, ComCtrls, Menus, ToolWin,
Buttons, JvHtControls, JvGIF;
type
TForm1 =
class(TForm)
Image1: TImage;
Timer1: TTimer;
Panel2: TPanel;
CoolBar1: TCoolBar;
ComboBox1: TComboBox;
BitBtn1: TBitBtn;
StaticText1: TStaticText;
XPManifest1: TXPManifest;
Image2: TImage;
StaticText2: TStaticText;
Edit1: TEdit;
procedure Timer1Timer(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Image1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure Image1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure Image1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure Edit1KeyDown(Sender: TObject;
var Key: Word;
Shift: TShiftState);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
dra,helper:boolean;
terrorspeicherx,terrorspeichery,xx,yy,terrorx,terrory:Integer;
implementation
{$R *.dfm}
procedure TForm1.Timer1Timer(Sender: TObject);
begin
if Dra=false
then statictext1.Caption:='
Map X: = '+inttostr(xx)+'
'+'
Map Y: = '+inttostr(yy);
if (mouse.cursorpos.x > form1.Left)
and (mouse.cursorpos.x < form1.Left+form1.width)
and
(mouse.CursorPos.y>form1.Top)
and (mouse.CursorPos.y < form1.top+form1.height)
And (helper=true)
then
begin
image1.left:=-terrorx+mouse.cursorpos.x-form1.left;
image1.top:=-terrory+mouse.cursorpos.y-form1.top;
// image2.left:=image1.Left+terrorx;
// image2.top:=image1.Top+terrory;
end
else
begin
//exit;
end;
if helper=false
then
begin
if (mouse.cursorpos.x<form1.Left)
and (image1.left<=30)
then image1.left:=image1.left+15;
if (mouse.cursorpos.x>form1.Left+form1.width)
and (image1.Left+image1.width>=form1.width-30)
then image1.left:=image1.left-15;
if (mouse.cursorpos.y<form1.top)
and (image1.top<=30)
then image1.top:=image1.top+15;
if (mouse.cursorpos.y>form1.top+form1.height)
and (image1.top+image1.height>=form1.height-59)
then image1.top:=image1.top-15;
end;
image2.left:=image1.left+terrorspeicherx;
image2.top:= image1.top+terrorspeichery;
//with map move funktion
statictext2.Left:= image1.left+terrorspeicherx+50;
statictext2.top:= image1.top+terrorspeichery+18;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Form1.DoubleBuffered:=true;
end;
procedure TForm1.Image1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if ssright
in shift
then
begin
terrorx:=+x+4;
terrory:=+y+30;
helper:=true;
dra:=true;
end;
if ssleft
in shift
then
begin
terrorspeicherx:=xx-5-image2.width
div 2;
terrorspeichery:=yy-image2.height-5;
image2.left:=image1.left+terrorspeicherx;
image2.top:=image1.top+terrorspeichery;
edit1.Left:=image1.left+terrorspeicherx+50;
edit1.Top:=image1.top+terrorspeichery+18;
edit1.Visible:=true;
edit1.setfocus;
end;
end;
procedure TForm1.Image1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
helper:=false;
dra:=false;
end;
procedure TForm1.Image1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
xx:=x+4;
yy:=y+30;
end;
procedure TForm1.Edit1KeyDown(Sender: TObject;
var Key: Word;
Shift: TShiftState);
begin
if key=VK_RETURN
then
begin
edit1.hide;
statictext2.Left:= image1.left+terrorspeicherx+50;
statictext2.top:= image1.top+terrorspeichery+18;
statictext2.caption:='
'+edit1.Text+'
';
statictext2.show;
end;
end;
end.