Cita:
Empezado por oregon
Otra cosilla. No se si es problema mío, o que el ejemplo lo hiciste así, pero el zoom sobre el rayado de ejemplo sólo podía verse en el área de zoom cuando hacía click con el ratón y luego lo movía sobre la imagen. ¿no es posible ver el zoom sin necesidad de "clickear", sino simplemente moviendo el ratón por encima de la image?
|
El titulo del formulario es "Ejemplo de Zoom - Mueve el raton sobre la imagen con el boton pulsado", asi que puede que lo hiciera de forma intencionada
.
Para cambiar eso, en el evento OnMouseMove:
Código Delphi
[-]
procedure TfrmMain.imgMainMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
var
Seleccion: TRect;
Bitmap: TBitmap;
begin
if ssLeft in Shift then begin
Seleccion.Left:= X - 20;
Seleccion.Right:= X + 20;
Seleccion.Top:= Y - 20;
Seleccion.Bottom:= Y + 20;
if btnCopiar.Checked then
begin
Copiar(imgMain.Canvas.Handle,pbZoom.Canvas.Handle,Seleccion,tbZoom.Position);
end;
if btnBorrar.Checked then
begin
pbZoom.Canvas.FillRect(pbZoom.Canvas.ClipRect);
Copiar(imgMain.Canvas.Handle,pbZoom.Canvas.Handle,Seleccion,tbZoom.Position);
end;
if btnBuffer.Checked then
begin
Bitmap:= TBitmap.Create;
try
Bitmap.Canvas.Brush.Color:= pbZoom.Canvas.Brush.Color;
Bitmap.Width:= pbZoom.Width;
Bitmap.Height:= pbZoom.Height;
Bitmap.Canvas.FillRect(pbZoom.Canvas.ClipRect);
Copiar(Canvas.Handle,Bitmap.Canvas.Handle,Seleccion,tbZoom.Position);
pbZoom.Canvas.Draw(0,0,Bitmap);
finally
Bitmap.Free;
end;
end;
end; end;