[]
        
(Showing Draft Content)

C1.Win.TouchToolKit.C1ApplicationZoom.MaxZoomFactor

MaxZoomFactor Property

MaxZoomFactor

Gets or sets the maximum zoom factor of the form.

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

A float value that represents the maximum zoom factor of the form. The default is 4f.

Examples

The following code example shows how to set the maxmum value of zoom factor.

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

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

	public GcZoomDemo()
	{
		InitializeComponent();

		_gcZoom1.Target = this;
		_maxZoomFactorTextBox.TextChanged += maxZoomFactorTextBox_TextChanged;
	}

	void maxZoomFactorTextBox_TextChanged(object sender, EventArgs e)
	{
		string value = _maxZoomFactorTextBox.Text.Trim();
		try
		{
			float maxFactor = (float)Convert.ToDouble(value);
			_gcZoom1.MaxZoomFactor = maxFactor;
		}
		catch
		{
			_gcZoom1.MaxZoomFactor = 2f;
		}
	}

	private void InitializeComponent()
	{
		_maxZoomFactorTextBox = new TextBox();
		this.Controls.Add(_maxZoomFactorTextBox);
	}
}
Public Class GcZoomDemo
		Inherits Form
		Private _maxZoomFactorTextBox As TextBox
		Private _gcZoom1 As New GcZoom()

		Public Sub New()
			InitializeComponent()

			_gcZoom1.Target = Me
			AddHandler _maxZoomFactorTextBox.TextChanged, AddressOf maxZoomFactorTextBox_TextChanged
		End Sub

		Private Sub maxZoomFactorTextBox_TextChanged(sender As Object, e As EventArgs)
			Dim value As String = _maxZoomFactorTextBox.Text.Trim()
			Try
				Dim maxFactor As Single = CSng(Convert.ToDouble(value))
				 _gcZoom1.MaxZoomFactor = maxFactor
			Catch
				_gcZoom1.MaxZoomFactor = 2.0F
			End Try
		End Sub

		Private Sub InitializeComponent()
			_maxZoomFactorTextBox = New TextBox()
			Me.Controls.Add(_maxZoomFactorTextBox)
		End Sub
 End Class
Exceptions
Type Condition
ArgumentOutOfRangeException

The assigned value less than 1f or more than 4f.