New to Telerik UI for WinFormsStart a free 30-day trial

Zooming

Updated over 6 months ago

The RadSyntaxEditor control provides out of the box zooming functionality. You can zoom in the opened document by holding the Ctrl key and spinning the mouse wheel or by using the ZoomComboBox located in the bottom-left corner of the control.

Figure 1: Zooming the RadSyntaxEditor

WinForms RadSyntaxEditor Zooming

The zooming functionality is enabled by default. To enable or disable it at run time you can use the AllowScaling property. If you want to disallow users to zoom through the control's UI, you can set the AllowScalling property to false.

Enable/Disable zooming

C#
this.radSyntaxEditor1.AllowScaling = false;

ScaleFactor

The zoom factor can also be controlled by setting the control's ScaleFactor property as demonstrated in Example 1. It can take values from 0.25 to 4 while values outside this range are corected to the closest valid value.

Setting the ScaleFactor

C#
this.radSyntaxEditor1.ScaleFactor = 1.5;

Figure 2: Setting the ScaleFactor

WinForms RadSyntaxEditor Setting ScaleFactor

Programmatic Zooming

You can also zoom the RadSyntaxEditor control programmatically by using the ZoomIn, ZoomOut and ZoomTo methods. When invoked, the ZoomIn and ZoomOut methods increase or decrease the ScaleFactor.

Zoom in and Zoom out

C#
this.radSyntaxEditor1.ZoomIn(); // The zoom increase factor is 1.1
this.radSyntaxEditor1.ZoomOut(); // The zoom decrease factor is 0.91

The ZoomTo method accepts a single argument - the zoom level to scroll to. This argument is directly set as the control's ScaleFactor and can thus accept values from 0.25 to 4, inclusive.

Zoom to a particular zoom level

C#
this.radSyntaxEditor1.ZoomTo(2);
In this article
ScaleFactorProgrammatic Zooming
Not finding the help you need?
Contact Support