You can also use your two fingers to zoom in and out the web page or a photo. Please enter your comment! Please enter your name here.
You have entered an incorrect email address! Save my name, email, and website in this browser for the next time I comment. Please click on the following link to open the newsletter signup page: Ghacks Newsletter Sign up. Ghacks is a technology news blog that was founded in by Martin Brinkmann.
It has since then become one of the most popular tech news sites on the Internet with five authors and regular contributions from freelance writers. Search for:. Martin Brinkmann. Windows , Windows 7. Microsoft Windows Security Updates January overview. Photos app update for Windows 11 rolls out with a new interface and editing options. Here's how to install the new Media Player in the Windows 11 stable channel. Multi-touch can only be enabled if all drivers were installed.
It is the last tab on the list of tabs. To disable Multi-touch, simply reverse the procedure. If in doubt, follow the steps listed below. The zoom gesture allows you to scale the size of your objects. Figure 4 illustrates how the zoom gesture works. The gesture info-structure includes the dwFlags member that is used to determine the state of the gesture and can include any of the following values:.
For zoom gesture, the ptsLocation indicates the center of the zoom. The following zoom message that arrives is handled by the default case. Next, we calculate the zoom center point, the zoom, and last we update rectangular our graphic object to reflect the zoom center point and zooming ratio. Figure 5 showcases these arguments. In the default case handler, we save the location of the gesture, and from the two sets of points representing the current touch point and the previous one we calculate the zoom center location and store it in ptZoomCenter.
We also calculate the zoom factor by calculating the ratio between the two points. A call to the ProcessZoom helper function updates the new coordinates to reflect the zoom factor and center point.
Handling the rest of the Windows 7 default gestures is very similar to the specific zoom gesture handling described above. All gestures follow the same flow, and just the internal logical implementation differs per gesture, per use-case scenario.
Next, we review the optimal model and dive into the API that allows you to receive and handle raw touch events. Calling this function registers a single hWnd element usually a window as being touch-enabled. Next, we iterate through the touch points array, applying our logic to each touch point, the handle ti[i] comment. Failing to do so will result in memory leaks. It is important to note that the X and Y coordinates are in hundredths of a pixel of physical screen coordinates i.
This extra-fine resolution promotes high precision and accurate handwrite recognition for other applications that may require such fine resolution.
But for most scenarios, you need to remember to divide the touch point X and Y coordinates by a hundred to translate the touch point coordinates to usable screen coordinates before you start using these coordinates. Tracking Touch Point IDsTo create the Scratch Pad application, you need to track each touch point movement and the path that it forms, and then paint a line along that path.
To distinguish between the different touch points and to make sure you really handle each touch point correctly, we assign different color to each touch point. After unpacking the touch message into an array of touch input structures, ti , you need to check each touch point state and apply different logic per touch state. You register the new touch point ID and assign it a color.
For each move message, you add a new point to the existing line and paint the new segment of the line. The key for tracking individual touch points is using the dwID that remains the same through the duration of specific touch stroke. This line is the path form when you drag your finger across the touch-sensitive device.
0コメント