Articles in this section

How to zoom in and zoom out in the WinForms GridControl?

Zooming


You can implement the zoom functionality in the
WinForms GridControl by increasing or decreasing the font size, column widths, and row heights proportionally.


The following code example illustrates the Zoom down functionality in GridControl on button click.

private void button2_Click(object sender, System.EventArgs e)
{
 //down
 this.gridControl1.BeginUpdate();
 this.gridControl1.BaseStylesMap["Standard"].StyleInfo.Font.Size *= down;
 this.gridControl1.DefaultColWidth = (int) (down * this.gridControl1.DefaultColWidth);
 this.gridControl1.ColWidths[0] = (int) (down * this.gridControl1.ColWidths[0]);
 this.gridControl1.DefaultRowHeight = (int) (down * this.gridControl1.DefaultRowHeight);
 this.gridControl1.RowHeights[0] = (int) (down * this.gridControl1.RowHeights[0]);
 this.gridControl1.EndUpdate();
 this.gridControl1.Refresh();
}
Private Sub button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button2.Click
 'down
 Me.gridControl1.BeginUpdate()
 Me.gridControl1.BaseStylesMap("Standard").StyleInfo.Font.Size *= down
 Me.gridControl1.DefaultColWidth = CInt(Fix(down * Me.gridControl1.DefaultColWidth))
 Me.gridControl1.ColWidths(0) = CInt(Fix(down * Me.gridControl1.ColWidths(0)))
 Me.gridControl1.DefaultRowHeight = CInt(Fix(down * Me.gridControl1.DefaultRowHeight))
 Me.gridControl1.RowHeights(0) = CInt(Fix(down * Me.gridControl1.RowHeights(0)))
 Me.gridControl1.EndUpdate()
 Me.gridControl1.Refresh()
End Sub

The following code example illustrates the Zoom up functionality in GridControl on button click.

private void button1_Click(object sender, System.EventArgs e)
{
 //up
 this.gridControl1.BeginUpdate();
 this.gridControl1.BaseStylesMap["Standard"].StyleInfo.Font.Size *= up;
 this.gridControl1.DefaultColWidth = (int) (up * this.gridControl1.DefaultColWidth);
 this.gridControl1.ColWidths[0] = (int) (up * this.gridControl1.ColWidths[0]);
 this.gridControl1.DefaultRowHeight = (int) (up * this.gridControl1.DefaultRowHeight);
 this.gridControl1.RowHeights[0] = (int) (up * this.gridControl1.RowHeights[0]);
 this.gridControl1.EndUpdate();
 this.gridControl1.Refresh();
}
Private Sub button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button1.Click
 'up
 Me.gridControl1.BeginUpdate()
 Me.gridControl1.BaseStylesMap("Standard").StyleInfo.Font.Size *= up
 Me.gridControl1.DefaultColWidth = CInt(Fix(up * Me.gridControl1.DefaultColWidth))
 Me.gridControl1.ColWidths(0) = CInt(Fix(up * Me.gridControl1.ColWidths(0)))
 Me.gridControl1.DefaultRowHeight = CInt(Fix(up * Me.gridControl1.DefaultRowHeight))
 Me.gridControl1.RowHeights(0) = CInt(Fix(up * Me.gridControl1.RowHeights(0)))
 Me.gridControl1.EndUpdate()
 Me.gridControl1.Refresh()
End Sub

The following screenshots illustrate the Zoom up and Zoom down functionality of GridControl.

Zoom up function of gridcontrol


Figure
1: Zoom up function of GridControl


Zoom down function of gridcontrol


 
 Figure
2: Zoom down function of GridControl


SampleWF-14479_How_Zooming_GridControl471662167.zip

 

Reference Link: Zooming

 

Conclusion

I hope you enjoyed learning about how to zoom in and zoom out in the WinForms GridControl.


You can refer to our WinForms GridControl feature tour page to know about its other groundbreaking feature representations and WinForms GridControl documentation, and how to quickly get started for configuration specifications. You can also explore our WinForms GridControl example to understand how to create and manipulate data.


For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.


If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied