Spread WPF Documentation
Allowing Zooming
Spread WPF Documentation > Developer's Guide > Managing the User Interface > Allowing Zooming

You can zoom in or out of the control. Use Ctrl + mouse wheel to zoom.

The cell size and contents will change as well as the viewport and drop-down button.

Borders, grid lines, freeze lines, split bars, and the selection indicator are not affected.

You can set a zoom factor to a value between .1 and 4. Set the ZoomFactor property in the PrintInfo class for printing.

You can specify whether the user can zoom with the CanUserZoom property in code.

Using Code

The following example allows the user to zoom.

CS
Copy Code
gcSpreadSheet1.CanUserZoom = true;
gcSpreadSheet1.Invalidate();
 private void button1_Click(object sender, RoutedEventArgs e)
        {
     gcSpreadSheet1.Sheets[0].ZoomFactor = 2;
     gcSpreadSheet1.Invalidate();
        }
VB.NET
Copy Code
GcSpreadSheet1.CanUserZoom = True
GcSpreadSheet1.Invalidate()
Private Sub Button1_Click(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles Button1.Click
     GcSpreadSheet1.Sheets(0).ZoomFactor = 2
     GcSpreadSheet1.Invalidate()
End Sub