Ein leeres Formular, 1 Panel darauf, 1 Image auf PANEL, Image.Align = alClient in
OI stellen.
Events zuweisen, in OnCreate Event des Formulars ein Bild laden(Image1.Picture.LoadFromFile('filenname.ext') ) und das wars.
EDIT:
Image.AutoSize = False; Image.Strech = True;
Delphi-Quellcode:
type
TForm1 = class(TForm)
Panel1: TPanel;
Image1: TImage;
procedure Panel1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure Image1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure Image1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure Panel1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
private
{ Private declarations }
public
{ Public declarations }
movement: integer;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Panel1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if (Sender is TWinControl) then
begin
ReleaseCapture; //Fängt alle Mausereignisse ab
TWinControl(Sender).Perform(WM_SysCommand, movement, 0);
end;
end;
procedure TForm1.Image1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
Panel1mousedown(panel1, button, shift, x, y);
end;
procedure TForm1.Image1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
panel1mousemove(panel1, shift, x, y);
end;
procedure TForm1.Panel1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
movement := $F012;
panel1.Cursor := crArrow;
if x < 6 then
begin
Panel1.Cursor := crSizeWE;
Movement := $F001;
if y < 6 then
begin
Movement := $F004;
panel1.Cursor := crSizeNWSE;
end else
if y > panel1.Height - 6 then
begin
movement := $F007;
panel1.Cursor := crSizeNESW;
end;
end
else
if x > panel1.Width - 6 then
begin
panel1.Cursor := crSizeWE;
movement := $F002;
if y < 6 then
begin
movement := $F005;
panel1.Cursor := crSizeNESW;
end else
if y > panel1.Height - 6 then
begin
movement := $F008;
panel1.Cursor := crSizeNWSE;
end;
end else
if y < 6 then
begin
movement := $F003;
panel1.Cursor := crSizeNS;
end else
if y > panel1.Height - 6 then
begin
movement := $F006;
panel1.Cursor := crSizeNS;
end;
end;
end.