# C1.Win.TouchToolKit.C1ZoomPanel.ZoomFactor

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_Win_TouchToolKit_C1ZoomPanel_ZoomFactor_" data-uid="C1.Win.TouchToolKit.C1ZoomPanel.ZoomFactor*">ZoomFactor Property
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_Win_TouchToolKit_C1ZoomPanel_ZoomFactor_" data-uid="C1.Win.TouchToolKit.C1ZoomPanel.ZoomFactor*"></a>
<h4 id="C1_Win_TouchToolKit_C1ZoomPanel_ZoomFactor" data-uid="C1.Win.TouchToolKit.C1ZoomPanel.ZoomFactor">ZoomFactor</h4>
<div class="markdown level1 summary"><p>Gets or sets the zoom factor of the panel.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">[TypeConverter(typeof(j))]
public float ZoomFactor { get; set; }</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">&lt;TypeConverter(GetType(j))&gt;
Public Property ZoomFactor As Single</code></pre>
</div>
<h5 class="propertyValue">Property Value</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</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><p>A <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.single">float</a> value that represents the zoom factor of the panel.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="C1_Win_TouchToolKit_C1ZoomPanel_ZoomFactor_remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>
  The <b>ZoomFactor</b>'s range is from 1 to <a class="xref" href="C1.Win.TouchToolKit.C1ZoomPanel.MaxZoomFactor.html#C1_Win_TouchToolKit_C1ZoomPanel_MaxZoomFactor">MaxZoomFactor</a>.
</p>
<p>
  If the <a class="xref" href="C1.Win.TouchToolKit.C1ZoomPanel.AllowPinchZoom.html#C1_Win_TouchToolKit_C1ZoomPanel_AllowPinchZoom">AllowPinchZoom</a> property is <a href="https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool">true</a> the user can change the <a class="xref" href="C1.Win.TouchToolKit.C1ZoomPanel.ZoomFactor.html#C1_Win_TouchToolKit_C1ZoomPanel_ZoomFactor">ZoomFactor</a> with gesture.
</p>
</div>
<h5 id="C1_Win_TouchToolKit_C1ZoomPanel_ZoomFactor_examples">Examples</h5>
<p>
  The following code example shows how to use this property. 
</p>
<p>
  This code example is part of a larger example provided for the <a class="xref" href="C1.Win.TouchToolKit.C1Zoom.html">C1Zoom</a> class. 
</p>
<pre><code class="lang-csharp">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);
	}
}</code></pre>
<pre><code class="lang-csharp">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</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>
<h5 id="C1_Win_TouchToolKit_C1ZoomPanel_ZoomFactor_seealso">See Also</h5>
<div class="seealso">
    <div><a class="xref" href="C1.Win.TouchToolKit.C1ZoomPanel.AllowPinchZoom.html#C1_Win_TouchToolKit_C1ZoomPanel_AllowPinchZoom">AllowPinchZoom</a></div>
</div>
</div>
