type
TForm1 =
class(TForm)
Image1: TImage;
SBHorz: TScrollBar;
SBVert: TScrollBar;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure SBVertChange(Sender: TObject);
procedure SBHorzChange(Sender: TObject);
private
{ Private-Deklarationen }
FBitmap : TBitmap;
procedure SetBitmap(X,Y : Integer);
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
begin
FBitmap:=TBitmap.Create;
FBitmap.LoadFromFile(ExtractFilePath(ParamStr(0))+'
Karparten.bmp');
SBVert.Max:=FBitmap.Height-Image1.Height;
SBHorz.Max:=FBitmap.Width-Image1.Width;
SetBitmap(0,0);
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
FBitmap.Free;
end;
procedure TForm1.SetBitmap(X, Y: Integer);
begin
With Image1.Canvas
do
begin
// Hier wird das Bild verschoben
BitBlt(
Handle,0,0,Image1.Width,Image1.Height,FBitmap.Canvas.Handle,X,Y,SRCCOPY);
end;
Image1.Invalidate;
end;
procedure TForm1.SBVertChange(Sender: TObject);
begin
SetBitmap(SBHorz.Position,SBVert.Position);
end;
procedure TForm1.SBHorzChange(Sender: TObject);
begin
SetBitmap(SBHorz.Position,SBVert.Position);
end;
end.