[]
        
(Showing Draft Content)

C1.Win.TouchToolKit.C1Zoom.ZoomFactor

ZoomFactor Property

ZoomFactor

Gets or sets the zoom factor of the form.

Declaration
[TypeConverter(typeof(m))]
public float ZoomFactor { get; set; }
Property Value
Type Description
float

A float value that represents the zoom factor of the form.

Remarks

The ZoomFactor's range is from 1 to MaxZoomFactor.

If the AllowPinchZoom property is true the user can change the ZoomFactor with gesture.

Examples

The following code example shows how to use this property.

This code example is part of a larger example provided for the C1Zoom class.

public class GcZoomDemo : Form
{
	private TextBox _zoomFactorTextBox;
	private GcZoom _gcZoom1 = new GcZoom();

	public GcZoomDemo()
	{
		InitializeComponent();

	 	_gcZoom1.Target = this;

	 	_zoomFactorTextBox.TextChanged += zoomFactorTextBox_TextChanged;
	}

	void zoomFactorTextBox_TextChanged(object sender, EventArgs e)
	{
		string value = _zoomFactorTextBox.Text.Trim();

	 	try
	 	{
			float zoomFactor = (float)Convert.ToDouble(value);
			_gcZoom1.ZoomFactor = zoomFactor;
	 	}
	 	catch
	 	{
			Console.WriteLine(e.ToString());
			_gcZoom1.ZoomFactor = 1f;
	 	}
	}

	private void InitializeComponent()
	{
		_zoomFactorTextBox = new TextBox();
		_zoomFactorTextBox.Location = new Point(160, 110);
		this.Controls.Add(_zoomFactorTextBox);
	}
}
Public Class GcZoomDemo
	Inherits Form
	Private _zoomFactorTextBox As TextBox
	Private _gcZoom1 As New GcZoom()

	Public Sub New()
		InitializeComponent()

		_gcZoom1.Target = Me

		AddHandler _zoomFactorTextBox.TextChanged, AddressOf zoomFactorTextBox_TextChanged
	End Sub

	Private Sub zoomFactorTextBox_TextChanged(sender As Object, e As EventArgs)
		Dim value As String = _zoomFactorTextBox.Text.Trim()

		Try
			Dim zoomFactor As Single = CSng(Convert.ToDouble(value))
			_gcZoom1.ZoomFactor = zoomFactor
		Catch
			Console.WriteLine(e.ToString())
			_gcZoom1.ZoomFactor = 1.0F
		End Try
	End Sub

	Private Sub InitializeComponent()
 		_zoomFactorTextBox = New TextBox()
 		_zoomFactorTextBox.Location = New Point(160, 110)
 		Me.Controls.Add(_zoomFactorTextBox)
	End Sub
End Class
Exceptions
Type Condition
ArgumentOutOfRangeException

The assigned value is greater than MaxZoomFactor or less than 1.

See Also