Ich mache das im onGesture-Event wie folgt:
Code:
if (Sender is TImage) then
begin
if EventInfo.GestureID = igiZoom then
begin
Handled := true;
if gfBegin in EventInfo.Flags then
startDistance := EventInfo.Distance
else
begin // forführen der geste
if ((EventInfo.Distance)/startDistance < 1.1)
and ((EventInfo.Distance)/startDistance > 1) then
begin
(sender as Timage).Height := Trunc((sender as Timage).Height*((EventInfo.Distance)/startDistance));
(sender as Timage).Width := Trunc((sender as Timage).Width*((EventInfo.Distance)/startDistance));
end
else
begin
(sender as Timage).Height := Trunc((sender as Timage).Height*(EventInfo.Distance/startDistance));
(sender as Timage).Width := Trunc((sender as Timage).Width*(EventInfo.Distance/startDistance));
end;
startDistance := EventInfo.Distance;
(sender as TImage).Repaint;
end;
end;
if EventInfo.GestureID = 260 then
begin
Handled := true;
if gfBegin in EventInfo.Flags then
begin
offsetX := EventInfo.Location.X;
offsetY := EventInfo.Location.Y;
end
else
begin
(sender as Timage).BringToFront;
(sender as Timage).Left := (sender as Timage).Left+EventInfo.Location.X-offsetX;
(sender as Timage).Top := (sender as Timage).Top+EventInfo.Location.Y-offsetY;
end;
end;
end;