Any code samples to use pinch to zoom in Windows 7?

Any code samples to use pinch to zoom in Windows 7?

There is touch screen in Ultrabook then how to apply these basic touch operations on Windows 7 and Windows 8 Desktop?

11 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

I did not see any code samples but here is a beginner's article about touch in desktop applications that will get you started.

I am using C++ in Windows 8 Desktop. It is not Windows RT. I think it may be something handled by WM_TOUCH for general Windows. WPF seems apply to XAML canvas only.  

Multi-Touch Manipulation Events in WPF

I tried the sample in this link and it works pretty good as well.


Getting Started with Windows Touch Gestures

This is the solution I needed. In the code below

switch (gi.dwID) {
    case GID_ZOOM: // Code for zooming goes here
    bHandled = TRUE; break;

what I want is to resize the Window by Zoom-in/out. Any solution?


See the Quickstart: Touch input for an overview of touch and manipulation events. The sample code given there handles translation rather than scaling, but it's straightforward to include rotation and scaling:


<Rectangle Name="TestRectangle" Width="200" Height="200" Fill="Blue" ManipulationMode="All" />
Code behind:

public MainPage() {

         InitializeComponent(); // Add handler for the ManipulationDelta event
         TestRectangle.ManipulationDelta += new ManipulationDeltaEventHandler((sender, e) => {
                    UIElement element = sender as UIElement;
                    CompositeTransform transform = element.RenderTransform as CompositeTransform;
                    if (transform != null) {
                              transform.ScaleX *= e.DeltaManipulation.Scale;
                              transform.ScaleY *= e.DeltaManipulation.Scale;
                              transform.Rotation += e.DeltaManipulation.Rotation * 180 / Math.PI;
                              transform.TranslateX += e.DeltaManipulation.Translation.X;
                              transform.TranslateY += e.DeltaManipulation.Translation.Y;
             TestRectangle.RenderTransform = new CompositeTransform();

I dont think so u can use pinch and zoom in windows 7

try this link. I see a pretty good example here.



Shashi wrote:

I dont think so u can use pinch and zoom in windows 7

Maybe you are right. So far I have not found a solution for native Windows (not WFP).

Leave a Comment

Please sign in to add a comment. Not a member? Join today