Die Events von TImgView32 liefern die Position relativ zu den Scrollbalken, das OffScreenBitmap will sie aber logischerweise relativ zu seinem Nullpunkt.
TCustomImage32.ControlToBitmap
Delphi-Quellcode:
procedure TForm1.FormCreate(Sender: TObject);
begin
ImgView321.Bitmap.SetSize(500, 500);
end;
procedure TForm1.ImgView321MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer; Layer: TCustomLayer);
var
RelPoint: TPoint;
begin
RelPoint := ImgView321.ControlToBitmap(Point(X, Y));
ImgView321.Bitmap.MoveTo(RelPoint.X, RelPoint.Y);
end;
procedure TForm1.ImgView321MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer; Layer: TCustomLayer);
var
RelPoint: TPoint;
begin
if ssLeft in Shift then
begin
RelPoint := ImgView321.ControlToBitmap(Point(X, Y));
ImgView321.Bitmap.LineToAS(RelPoint.X, RelPoint.Y);
end;
end;