# C1.Win.TouchToolKit.C1ZoomPanel.SetZoomFactor

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_Win_TouchToolKit_C1ZoomPanel_SetZoomFactor_" data-uid="C1.Win.TouchToolKit.C1ZoomPanel.SetZoomFactor*">SetZoomFactor Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_Win_TouchToolKit_C1ZoomPanel_SetZoomFactor_" data-uid="C1.Win.TouchToolKit.C1ZoomPanel.SetZoomFactor*"></a>
<h4 id="C1_Win_TouchToolKit_C1ZoomPanel_SetZoomFactor_System_Single_System_Boolean_" data-uid="C1.Win.TouchToolKit.C1ZoomPanel.SetZoomFactor(System.Single,System.Boolean)">SetZoomFactor(float, bool)</h4>
<div class="markdown level1 summary"><p>Sets the <a class="xref" href="C1.Win.TouchToolKit.C1ZoomPanel.ZoomFactor.html#C1_Win_TouchToolKit_C1ZoomPanel_ZoomFactor">ZoomFactor</a> and determines wheather use animation when change <a class="xref" href="C1.Win.TouchToolKit.C1ZoomPanel.ZoomFactor.html#C1_Win_TouchToolKit_C1ZoomPanel_ZoomFactor">ZoomFactor</a>.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public void SetZoomFactor(float zoomFactor, bool useAnimation = false)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub SetZoomFactor(zoomFactor As Single, Optional useAnimation As Boolean = False)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.single">float</a></td>
      <td><span class="parametername">zoomFactor</span></td>
      <td><p>The new zoom factor.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">useAnimation</span></td>
      <td><p>true to use animation; otherwise, false.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="C1_Win_TouchToolKit_C1ZoomPanel_SetZoomFactor_System_Single_System_Boolean__examples">Examples</h5>
<p>
  The following code example shows how to use this method.
</p>
<p>
  This code example is part of a larger example provided for the <a class="xref" href="C1.Win.TouchToolKit.AnimationStartingEventArgs.html">AnimationStartingEventArgs</a> class.
</p>
<pre><code class="lang-csharp">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);
	}
}</code></pre>
<pre><code class="lang-csharp">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</code></pre>

<h5 class="exceptions">Exceptions</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Condition</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.argumentoutofrangeexception">ArgumentOutOfRangeException</a></td>
      <td><p>The assigned value is greater than <a class="xref" href="C1.Win.TouchToolKit.C1ZoomPanel.MaxZoomFactor.html#C1_Win_TouchToolKit_C1ZoomPanel_MaxZoomFactor">MaxZoomFactor</a> or less than 1.</p>
</td>
    </tr>
  </tbody>
</table>
</div>
