Thema: Delphi Suche Touch Demo

Einzelnen Beitrag anzeigen

Darlo

Registriert seit: 28. Jul 2008
Ort: München
1.196 Beiträge
 
Delphi 10.2 Tokyo Enterprise
 
#2

AW: Suche Touch Demo

  Alt 14. Sep 2011, 13:31
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;
Philip
  Mit Zitat antworten Zitat