Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Gráficos (https://www.clubdelphi.com/foros/forumdisplay.php?f=8)
-   -   Como centrar una imagen en un timage con un click (https://www.clubdelphi.com/foros/showthread.php?t=61809)

The_Duke 23-11-2008 03:00:20

Como centrar una imagen en un timage con un click
 
Hola le explico estoy haciendo un visor de imagen y al hacer zoom, necesito que si le hacen click con el mouse se centre la zona donde se izo el click:confused:, hago el zoom así:

Código Delphi [-]
procedure TForm1.Image1Click(Sender: TObject);
var
re1, re2: integer;
begin
zoom:=zoom+1;
re1:=round(Image1.Width*6/100);
re2:=round(Image1.Height*6/100);
Image1.Width:=Image1.Width+re1;
Image1.Height:=Image1.Height+re2;
sScrollBox1.VertScrollBar.Visible:=true;
sScrollBox1.HorzScrollBar.Visible:=true;
zoom:=zoom+1;
Image1.Stretch:=true;
ajustar;
end;

y el ajustar es:

Código Delphi [-]
procedure TForm1.ajustar;
begin
sScrollBox1.VertScrollBar.Margin:=Image1.Height;
sScrollBox1.HorzScrollBar.Margin:=Image1.Width;
if (Image1.Width>Form1.Width) and (Image1.Height>Form1.Height) then
  begin
    Image1.Left :=1;
    Image1.Top :=1;
  end
else
  if (Image1.Width>Form1.Width) and (Image1.Heightthen
     begin
       Image1.Left :=1;
       Image1.Top := (Form1.Height div 2) - (Image1.Height div 2);
      end
 else
   if (Image1.Widthand (Image1.Height>Form1.Height) then
       begin
         Image1.Left := (Form1.Width div 2) - (Image1.Width div 2);
         Image1.Top := 1;
       end
     else
        if (Image1.Widthand (Image1.Heightthen
       begin
           Image1.Left := (Form1.Width div 2) - (Image1.Width div 2);
           Image1.Top := (Form1.Height div 2) - (Image1.Height div 2);
       end;
end;

andres*** 24-11-2008 01:58:14

Hola Quisiera Saber Como Crear Un Boton En Delphi Que Me Haga Un Bakup De Las Tablas

Caral 24-11-2008 02:04:25

Hola
andres***, No puedes hacer las preguntas en todos los hilos que encuentres.
Por favor lee la guia de estilo del club.
Tus preguntas se contestaran, ten paciencia.
Saludos

andres*** 24-11-2008 02:07:03

perdon....soy nuevo...


La franja horaria es GMT +2. Ahora son las 20:57:01.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi