Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8089817
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T19:31:29+00:00 2026-06-05T19:31:29+00:00

Using Delphi XE 2 I’ve trying to identify the zoom direction to apply the

  • 0

Using Delphi XE 2 I’ve trying to identify the zoom direction to apply the zoom efect to an image (TImage) but didnt find an function to do it and the EventInfo property in the event OnGesture of the Image didnt have this information.

I’ve seen a lote of samples using Direct2d to zoom in and zoom out but it uses the wp_touch messages direct to do it and the zoom effects are performed using transform matrix scale functions from direct 2d but i dont want to use direct2d to this project as it will only have this zoom in and out effect based on touch, the other things is simple clicks.

It could be possible to identify the in/out storing the first direction and comparing to the current one since the EventInfo parameter has an property Direction but i dont think this is the nice way to do it or i’m wrong ?

So after that is there any recomendations or examples on how to perform the zoom effect in a TImage ? I’ve already done that but it does not pan with when zooming to give the pinch efect that every application does.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T19:31:30+00:00Added an answer on June 5, 2026 at 7:31 pm

    After reading a lote of documentations I found out that the right way to do is:

    Intercept the EventInfo.GestureID to identify the command desired in my case the zoom command, after that you should read the EventInfo.Flags and to identify if it is the gfBegin so you can cache the first location point (x,y) and the first distance and when the flag is diferent then gfBegin you perform your calculations using the firstpoint and the currentpoint (EventInfo.Location)

    Basic the command should be like that:

     case EventInfo.GestureID of
      igiZoom:
       begin
         if (EventInfo.Flags = [gfBegin]) then
          begin
            FLastDistance := EventInfo.Distance;
            FFirstPoint.X := EventInfo.Location.X;
            FFirstPoint.Y := EventInfo.Location.Y;
            FFirstPoint := ScreenToClient(FFirstPoint);
    
            if (FSecondPoint.X = 0) and (FSecondPoint.Y = 0) then
             begin
              FSecondPoint.X := EventInfo.Location.X + 10;
              FSecondPoint.Y := EventInfo.Location.Y + 10;
              FSecondPoint := ScreenToClient(FSecondPoint);
             end;
            //ZoomCenter is a local TPoint var 
            ZoomCenter.Create(((FFirstPoint.X + FSecondPoint.X) div 2),
                              ((FFirstPoint.Y + FSecondPoint.Y) div 2));
            //Apply the zoom to the object  
            FDrawingObject.Zoom(EventInfo.Distance / FLastDistance, ZoomCenter.X, ZoomCenter.Y);
    
            Invalidate;
          end
           else
             begin
                FSecondPoint.X := EventInfo.Location.X;
                FSecondPoint.Y := EventInfo.Location.Y;
                FSecondPoint := ScreenToClient(FSecondPoint);
    
                ZoomCenter.Create(((FFirstPoint.X + FSecondPoint.X) div 2),
                                  ((FFirstPoint.Y + FSecondPoint.Y) div 2));
    
                FDrawingObject.Zoom(EventInfo.Distance / FLastDistance, ZoomCenter.X, ZoomCenter.Y);
    
                Invalidate;
                //Update with the new values for next interaction
                FFirstPoint := FSecondPoint;
                FLastDistance := EventInfo.Distance;
             end;
    

    There is a sample code write in c# available in the Windows v7.0 SDK that can be used as reference and helps me a lote.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using Delphi, I need a function to evaluate the current date and see if
By using Delphi 5, can I call a function in web service which is
I am using Delphi 7 but I have trialed the Delphi 2005 - 2010
Using Delphi 2010. I am looking for (possibly) a function or procedure which can
Using Delphi XE. When trying to access a Delphi interface object from a DLL,
I am using Delphi TApplication.OnException Event to catch unhandled exceptions This works well but
My classmates started using Delphi with pascal but I as c++ porgrammer have to
Using Delphi 2010 I would like to copy a PNG image to the clipboard
I am using Delphi XE, but the same issue already bothered me when using
I'm using Delphi (7-2010) and trying to figure out a good way to handle

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.