MultiRow Windows Forms > Developer's Guide > Using MultiRow > Multi-touch Features > Zooming |
In MultiRow, you can zoom the contents of the grid using the stretch and pinch gesture. This section describes the feature to zoom the grid, using touch.
You can use the MinZoomFactor property to set the minimum zoom percentage. If you zoom to less than the minimum zoom percentage using the pinch gesture, the screen reverts back to the zoom percentage that is set in the MinZoomFactor property.
The following code sets the minimum zoom percentage to 100%.
GcMultiRow1.MinZoomFactor = 1.0F |
gcMultiRow1.MinZoomFactor = 1.0F; |
You can use the TouchZoomSnapPoints property to set the snap point of the zoom. If the snap point is set, the zoom percentage is automatically set to the nearest snap point when you interrupt the stretch or pinch operation by removing your finger from the screen.
Use the following steps to add a snap point.
You can also add a snap point with code. You can use the Add or AddRange method to add a snap point.
This example uses the Add or AddRange method to add a snap point.
' Add a snap point of zoom percentage, using the Add method. GcMultiRow1.TouchZoomSnapPoints.Add(1.5F) GcMultiRow1.TouchZoomSnapPoints.Add(2.0F) GcMultiRow1.TouchZoomSnapPoints.Add(2.5F) ' Add a zoom percentage snap point, using the AddRange method. GcMultiRow1.TouchZoomSnapPoints.AddRange(New Single() {3.0F, 3.5F}) |
// Add a snap point of zoom percentage, using the Add method. gcMultiRow1.TouchZoomSnapPoints.Add(1.5F); gcMultiRow1.TouchZoomSnapPoints.Add(2F); gcMultiRow1.TouchZoomSnapPoints.Add(2.5F); // Add a zoom percentage snap point, using the AddRange method. gcMultiRow1.TouchZoomSnapPoints.AddRange(new float[] { 3F, 3.5F }); |
You need to zoom to a value greater than the value set in the TouchZoomSnapDistance property, so that the zoom percentage is automatically set and uses the snap point. For example, if the TouchZoomSnapDistance property is set to 1, the zoom percentage is not set automatically to the snap point, unless you change the zoom percentage to 100% or more, by a single stretch or pinch operation.
This example sets the TouchZoomSnapDistance property.
' The zoom percentage is automatically set when the |
// The zoom percentage is automatically set when the |
Setting the AllowUserToTouchZoom property to False disables zooming using the touch operation. By disabling the zoom operation using touch, you can prevent accidental zooming while scrolling or other operations.
This example sets the AllowUserToTouchZoom property.
GcMultiRow1.AllowUserToTouchZoom = False |
gcMultiRow1.AllowUserToTouchZoom = false; |