Visualizzazione dei risultati da 1 a 2 su 2
  1. #1

    [delphi]zoom immagine

    Per zoomare un'immagine uso questo codice:
    codice:
    procedure TFormFoglioRettangolo.ImgFoglioRettangoloMouseDown(Sender: TObject;
      Button: TMouseButton; Shift: TShiftState; X, Y: Integer; Layer: TCustomLayer);
    
      var
        zoom:double;
      begin
       ImgProva.AutoSize := False;
       ImgProva.ScaleMode := smStretch;
       case Button of
         mbLeft:
           begin
              if  (ImgProva.width >4147) then
              zoom:=1
              else zoom:=0.8;
             ImgProva.Width := Trunc(ImgProva.Width / zoom);
             ImgProva.Height := Trunc(ImgProva.Height / zoom);
    
           end;
         mbMiddle:
           begin
             ImgProva.ScaleMode := smNormal;
             ImgProva.AutoSize := True;
           end;
         mbRight:
           begin
             if (ImgProva.width <1200) then
              zoom:=1
            else zoom:=0.8;
             ImgProva.Width := Trunc(ImgProva.Width * zoom);
             ImgProva.Height := Trunc(ImgProva.Height * zoom);
           end;
    end;
    end;
    L'effetto ottenuto è di avere l'immagine ingrandita o rimpicciolita allineata in alto a sinistra, io invece vorrei che l'immagine fosse centrata sul punto dove il mouse ha fatto click per ingrandirla.
    Altrimenti si otterrebbe un effetto "disorientante" per chi cerca di ingrandire un particolare che gli interessa.
    Penso che dovrei agire sulle coordinate del mouse ma non so proprio come. Qualcuno potrebbe farmi un esempio? Grazie.

  2. #2

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.