[]
        
(Showing Draft Content)

C1.Win.TouchToolKit.C1ZoomPanel.SetZoomFactor

SetZoomFactor Method

SetZoomFactor(float, bool)

Sets the ZoomFactor and determines wheather use animation when change ZoomFactor.

Declaration
public void SetZoomFactor(float zoomFactor, bool useAnimation = false)
Parameters
Type Name Description
float zoomFactor

The new zoom factor.

bool useAnimation

true to use animation; otherwise, false.

Examples

The following code example shows how to use this method.

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

class GcZoomAnimationDemo : Form
{
	private Button _zoomOutBtn = new Button();
	private GcZoom _gcZoom1 = new GcZoom();

	public GcZoomAnimationDemo()
	{
		InitializeComponent();

		_gcZoom1.Target = this;

		_zoomOutBtn.Click += _zoomOutBtn_Click;
	}

	void _zoomOutBtn_Click(object sender, EventArgs e)
	{
		_gcZoom1.SetZoomFactor(1, true);
	}

	private void InitializeComponent()
	{
		this._zoomOutBtn.Location = new System.Drawing.Point(12, 200);
		this._zoomOutBtn.Size = new System.Drawing.Size(260, 30);
		this._zoomOutBtn.Text = "Zoom Out";
		this.Controls.Add(this._zoomOutBtn);
	}
}
Class GcZoomAnimationDemo
	Inherits Form
	Private _zoomOutBtn As New Button()
	Private _gcZoom1 As New GcZoom()

	Public Sub New()
		InitializeComponent()

		_gcZoom1.Target = Me

		AddHandler _zoomOutBtn.Click, AddressOf _zoomOutBtn_Click
	End Sub

	Private Sub _zoomOutBtn_Click(sender As Object, e As EventArgs)
		_gcZoom1.SetZoomFactor(1, True)
	End Sub

	 Private Sub InitializeComponent()
		Me._zoomOutBtn.Location = New System.Drawing.Point(12, 200)
		Me._zoomOutBtn.Size = New System.Drawing.Size(260, 30)
		Me._zoomOutBtn.Text = "Zoom Out"
		Me.Controls.Add(Me._zoomOutBtn)
	End Sub
End Class
Exceptions
Type Condition
ArgumentOutOfRangeException

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