0

I can't solve the problem, please help. I take a photo through TakePhotoFromCameraAction and upload the photo to TImage:

procedure TForm1.TakePhotoFromCameraAction1DidFinishTaking(Image: TBitmap);
begin
 ViewForm.Image1.Bitmap.Assign(Image);
 ViewForm.Show;
end;

TScrollBox Align: Client TImage Align:Center, TImage WrapMode: Fit

Zoom Image:

procedure TViewForm.Image1Gesture(Sender: TObject;
  const EventInfo: TGestureEventInfo; var Handled: Boolean);
var
  LObj: IControl;
  LImageCenter: TPointF;
begin

if EventInfo.GestureID = igiZoom then
  begin

    LObj := Self.ObjectAtPoint(ClientToScreen(EventInfo.Location));

    if LObj is TImage then
      begin
      if (not(TInteractiveGestureFlag.gfBegin in EventInfo.Flags)) and (not(TInteractiveGestureFlag.gfEnd in EventInfo.Flags)) then
        begin
         LImageCenter := Image1.Position.Point + PointF(Image1.Width / 2, Image1.Height / 2);
         Image1.Width := Max(Image1.Width + (EventInfo.Distance - FLastDistance)*5, 10);
         Image1.Height := Max(Image1.Height + (EventInfo.Distance - FLastDistance)*5, 10);
         Image1.Position.X := LImageCenter.X - Image1.Width / 2;
         Image1.Position.Y := LImageCenter.Y - Image1.Height / 2;
        end;
        FLastDistance := EventInfo.Distance;
   end;
  end;
end;

Everything works well, but I would like to completely fill the ScrollBox with an image. I tried to put different Align - but it's not that. How can I solve this problem? Thank you

Screenshots: left right

Alex
  • 1
  • 1
  • 2
  • Or is it possible to somehow limit the scrolling of the horizontal scroll to empty space? – Alex Feb 27 '23 at 14:54

0 Answers0