# C1.Win.TouchToolKit.ListViewZoomPolicy

## Content

<div class="doc-site-dotnet-api-container">



  <h1 id="C1_Win_TouchToolKit_ListViewZoomPolicy" data-uid="C1.Win.TouchToolKit.ListViewZoomPolicy" class="text-break">ListViewZoomPolicy Class
</h1>
  <div class="markdown level0 summary"><p>Represents a zoom policy for <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.windows.forms.listview">ListView</a> type control.</p>
</div>
  <div class="markdown level0 conceptual"></div>
  <div class="inheritance">
    <h5>Inheritance</h5>
    <div class="level0"><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object">object</a></div>
    <div class="level1"><a class="xref" href="C1.Win.TouchToolKit.ZoomPolicy.html">ZoomPolicy</a></div>
    <div class="level2"><span class="xref">ListViewZoomPolicy</span></div>
  </div>
  <h6><strong>Namespace</strong>: <a class="xref" href="C1.Win.TouchToolKit.html">C1.Win.TouchToolKit</a></h6>
  <h6><strong>Assembly</strong>: C1.Win.TouchToolKit.4.8.dll</h6>
  <h5 id="C1_Win_TouchToolKit_ListViewZoomPolicy_syntax">Syntax</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public class ListViewZoomPolicy : ZoomPolicy</code></pre>
  </div>
  <div class="codewrapper">
    <pre><code class="lang-vbnet hljs">Public Class ListViewZoomPolicy
    Inherits ZoomPolicy</code></pre>
  </div>
  <h5 id="C1_Win_TouchToolKit_ListViewZoomPolicy_remarks"><strong>Remarks</strong></h5>
  <div class="markdown level0 remarks"><p>This zoom policy zoom the column width of <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.windows.forms.listview">ListView</a> and change the font of all items.</p>
</div>
  <h5 id="C1_Win_TouchToolKit_ListViewZoomPolicy_examples"><strong>Examples</strong></h5>
  <p>
  The following code example shows how to use <a class="xref" href="C1.Win.TouchToolKit.ListViewZoomPolicy.html">ListViewZoomPolicy</a> class. 
</p>
<p>
  You can copy the code to a exsit Windows Forms appliction. And set the form in the sample code as start form. 
</p>
<p>
  If you find a licenses error when run this code. Try to drag a <a class="xref" href="C1.Win.TouchToolKit.C1Zoom.html">C1Zoom</a> component to a 
  any Form from tool box can generate the licenses information to this project.
</p>
<pre><code class="lang-csharp">public class ListViewZoomPolicyDemo : Form
{
	private ListView _listView;
	private CheckBox _enableCheckBox;
	private CheckBox _zoomColumnWidthCheckBox;
	private CheckBox _zoomItemFont;
	private TextBox _targetTypeTextBox;
	private ListViewZoomPolicy _listViewZoomPolicy = new ListViewZoomPolicy();
	private GcZoom _gcZoom1 = new GcZoom();

	public ListViewZoomPolicyDemo()
	{
		InitializeComponent();

		_gcZoom1.Target = this;

		// Set ListView's ZoomPolicy object
		_gcZoom1.ZoomPolicies.Add(_listViewZoomPolicy);

		// ListView control should to change default font
		foreach (ListViewItem item in _listView.Items)
		{
			item.Font = new Font(this.Font.FontFamily, this.Font.Size);
		}

		GetTargetType();

		_enableCheckBox.CheckedChanged += _enableCheckBox_CheckedChanged;
		_zoomColumnWidthCheckBox.CheckedChanged += _zoomColumnWidthCheckBox_CheckedChanged;
		_zoomItemFont.CheckedChanged += _zoomItemFont_CheckedChanged;
	}

	void GetTargetType()
	{
		_targetTypeTextBox.Text = _listViewZoomPolicy.TargetType.Name;
	}

	void _enableCheckBox_CheckedChanged(object sender, EventArgs e)
	{
		_gcZoom1.ZoomFactor = 1f;
		_listViewZoomPolicy.Enabled = _enableCheckBox.Checked;

		_zoomColumnWidthCheckBox.Enabled = _enableCheckBox.Checked;
		_zoomItemFont.Enabled = _enableCheckBox.Checked;
	}

	void _zoomColumnWidthCheckBox_CheckedChanged(object sender, EventArgs e)
	{
		_gcZoom1.ZoomFactor = 1f;
		_listViewZoomPolicy.ZoomColumnWidth = _zoomColumnWidthCheckBox.Checked;
	}

	void _zoomItemFont_CheckedChanged(object sender, EventArgs e)
	{
		_gcZoom1.ZoomFactor = 1f;
		_listViewZoomPolicy.ZoomItemFont = _zoomItemFont.Checked;
	}

	private void InitializeComponent()
	{
		_listView = new ListView();
		_listView.Location = new Point(20, 20);
		_listView.Size = new Size(400, 300);
		_listView.GridLines = true;

		_listView.View = View.Details;
		_listView.Columns.Add("", 100, HorizontalAlignment.Center);
		_listView.Columns.Add("", 100, HorizontalAlignment.Center);
		_listView.Columns.Add("", 100, HorizontalAlignment.Center);

		ListViewItem item1 = new ListViewItem(new string[] { "Item 1", "Item 2", "Item 3" });
		ListViewItem item2 = new ListViewItem(new string[] { "Item 4", "Item 5", "Item 6" });
		_listView.Items.Add(item1);
		_listView.Items.Add(item2);

		_enableCheckBox = new CheckBox();
		_enableCheckBox.Text = "Enabled";
		_enableCheckBox.Size = new Size(120, 20);
		_enableCheckBox.Location = new Point(450, 20);
		_enableCheckBox.Checked = true;

		_zoomColumnWidthCheckBox = new CheckBox();
		_zoomColumnWidthCheckBox.Text = "ZoomColumnWidth";
		_zoomColumnWidthCheckBox.Size = new Size(120, 20);
		_zoomColumnWidthCheckBox.Location = new Point(450, 50);
		_zoomColumnWidthCheckBox.Checked = true;

		_zoomItemFont = new CheckBox();
		_zoomItemFont.Text = "ZoomItemFont";
		_zoomItemFont.Size = new Size(120, 20);
		_zoomItemFont.Location = new Point(450, 80);
		_zoomItemFont.Checked = true;

		_targetTypeTextBox = new TextBox();
		_targetTypeTextBox.ReadOnly = true;
		_targetTypeTextBox.Size = new Size(120, 20);
		_targetTypeTextBox.Location = new Point(450, 110);

		this.Controls.Add(_listView);
		this.Controls.Add(_enableCheckBox);
		this.Controls.Add(_zoomColumnWidthCheckBox);
		this.Controls.Add(_zoomItemFont);
		this.Controls.Add(_targetTypeTextBox);
		this.Size = new Size(600, 450);
	}
}</code></pre>
<pre><code class="lang-csharp">Public Class ListViewZoomPolicyDemo
	Inherits Form
	Private _listView As ListView
	Private _enableCheckBox As CheckBox
	Private _zoomColumnWidthCheckBox As CheckBox
	Private _zoomItemFont As CheckBox
	Private _targetTypeTextBox As TextBox
	Private _listViewZoomPolicy As New ListViewZoomPolicy()
	Private _gcZoom1 As New GcZoom()

	Public Sub New()
		InitializeComponent()

		_gcZoom1.Target = Me

		' Set ListView's ZoomPolicy object
		_gcZoom1.ZoomPolicies.Add(_listViewZoomPolicy)

		' ListView control should to change default font
		For Each item As ListViewItem In _listView.Items
			item.Font = New Font(Me.Font.FontFamily, Me.Font.Size)
		Next

		GetTargetType()

		AddHandler _enableCheckBox.CheckedChanged, AddressOf _enableCheckBox_CheckedChanged
		AddHandler _zoomColumnWidthCheckBox.CheckedChanged, AddressOf _zoomColumnWidthCheckBox_CheckedChanged
		AddHandler _zoomItemFont.CheckedChanged, AddressOf _zoomItemFont_CheckedChanged
	End Sub

	Private Sub GetTargetType()
		_targetTypeTextBox.Text = _listViewZoomPolicy.TargetType.Name
	End Sub

	Private Sub _enableCheckBox_CheckedChanged(sender As Object, e As EventArgs)
		_gcZoom1.ZoomFactor = 1.0F
		_listViewZoomPolicy.Enabled = _enableCheckBox.Checked

		_zoomColumnWidthCheckBox.Enabled = _enableCheckBox.Checked
		_zoomItemFont.Enabled = _enableCheckBox.Checked
	End Sub

	Private Sub _zoomColumnWidthCheckBox_CheckedChanged(sender As Object, e As EventArgs)
		_gcZoom1.ZoomFactor = 1.0F
		_listViewZoomPolicy.ZoomColumnWidth = _zoomColumnWidthCheckBox.Checked
	End Sub

	Private Sub _zoomItemFont_CheckedChanged(sender As Object, e As EventArgs)
		_gcZoom1.ZoomFactor = 1.0F
		_listViewZoomPolicy.ZoomItemFont = _zoomItemFont.Checked
	End Sub

	Private Sub InitializeComponent()
		_listView = New ListView()
		_listView.Location = New Point(20, 20)
		_listView.Size = New Size(400, 300)
		_listView.GridLines = True

		_listView.View = View.Details
		_listView.Columns.Add("", 100, HorizontalAlignment.Center)
		_listView.Columns.Add("", 100, HorizontalAlignment.Center)
		_listView.Columns.Add("", 100, HorizontalAlignment.Center)

		Dim item1 As New ListViewItem(New String() { "Item 1", "Item 2", "Item 3"})
		Dim item2 As New ListViewItem(New String() { "Item 4", "Item 5", "Item 6"})
		_listView.Items.Add(item1)
		_listView.Items.Add(item2)

		_enableCheckBox = New CheckBox()
		_enableCheckBox.Text = "Enabled"
		_enableCheckBox.Size = New Size(120, 20)
		_enableCheckBox.Location = New Point(450, 20)
		_enableCheckBox.Checked = True

		_zoomColumnWidthCheckBox = New CheckBox()
		_zoomColumnWidthCheckBox.Text = "ZoomColumnWidth"
		_zoomColumnWidthCheckBox.Size = New Size(120, 20)
		_zoomColumnWidthCheckBox.Location = New Point(450, 50)
		_zoomColumnWidthCheckBox.Checked = True

		_zoomItemFont = New CheckBox()
		_zoomItemFont.Text = "ZoomItemFont"
		_zoomItemFont.Size = New Size(120, 20)
		_zoomItemFont.Location = New Point(450, 80)
		_zoomItemFont.Checked = True

		_targetTypeTextBox = New TextBox()
		_targetTypeTextBox.[ReadOnly] = True
		_targetTypeTextBox.Size = New Size(120, 20)
		_targetTypeTextBox.Location = New Point(450, 110)

		Me.Controls.Add(_listView)
		Me.Controls.Add(_enableCheckBox)
		Me.Controls.Add(_zoomColumnWidthCheckBox)
		Me.Controls.Add(_zoomItemFont)
		Me.Controls.Add(_targetTypeTextBox)
		Me.Size = New Size(600, 450)
	End Sub
End Class</code></pre>

  <h3 id="constructors">Constructors
</h3>
  <table class="table table-bordered table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td id="C1_Win_TouchToolKit_ListViewZoomPolicy__ctor" data-uid="C1.Win.TouchToolKit.ListViewZoomPolicy.#ctor">
          <a class="xref" href="C1.Win.TouchToolKit.ListViewZoomPolicy.-ctor.html#C1_Win_TouchToolKit_ListViewZoomPolicy__ctor">ListViewZoomPolicy()</a>
        </td>
        <td class="markdown level1 summary"></td>
      </tr>
    </tbody>
  </table>
  <h3 id="properties">Properties
</h3>
  <table class="table table-bordered table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td id="C1_Win_TouchToolKit_ListViewZoomPolicy_TargetType" data-uid="C1.Win.TouchToolKit.ListViewZoomPolicy.TargetType">
          <a class="xref" href="C1.Win.TouchToolKit.ListViewZoomPolicy.TargetType.html#C1_Win_TouchToolKit_ListViewZoomPolicy_TargetType">TargetType</a>
        </td>
        <td class="markdown level1 summary"><p>Gets the type indicates which control type can use this policy.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Win_TouchToolKit_ListViewZoomPolicy_ZoomColumnWidth" data-uid="C1.Win.TouchToolKit.ListViewZoomPolicy.ZoomColumnWidth">
          <a class="xref" href="C1.Win.TouchToolKit.ListViewZoomPolicy.ZoomColumnWidth.html#C1_Win_TouchToolKit_ListViewZoomPolicy_ZoomColumnWidth">ZoomColumnWidth</a>
        </td>
        <td class="markdown level1 summary"><p>Gets or sets a value indicating whether zoom column's width.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Win_TouchToolKit_ListViewZoomPolicy_ZoomIcon" data-uid="C1.Win.TouchToolKit.ListViewZoomPolicy.ZoomIcon">
          <a class="xref" href="C1.Win.TouchToolKit.ListViewZoomPolicy.ZoomIcon.html#C1_Win_TouchToolKit_ListViewZoomPolicy_ZoomIcon">ZoomIcon</a>
        </td>
        <td class="markdown level1 summary"><p>Gets or sets a value indicating whether zoom item's icon.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Win_TouchToolKit_ListViewZoomPolicy_ZoomItemFont" data-uid="C1.Win.TouchToolKit.ListViewZoomPolicy.ZoomItemFont">
          <a class="xref" href="C1.Win.TouchToolKit.ListViewZoomPolicy.ZoomItemFont.html#C1_Win_TouchToolKit_ListViewZoomPolicy_ZoomItemFont">ZoomItemFont</a>
        </td>
        <td class="markdown level1 summary"><p>Gets or sets a value indicating whether zoom item's font.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h3 id="methods">Methods
</h3>
  <table class="table table-bordered table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td id="C1_Win_TouchToolKit_ListViewZoomPolicy_ZoomBounds_System_Windows_Forms_Control_C1_Win_TouchToolKit_ZoomBoundsInfo_" data-uid="C1.Win.TouchToolKit.ListViewZoomPolicy.ZoomBounds(System.Windows.Forms.Control,C1.Win.TouchToolKit.ZoomBoundsInfo)">
          <a class="xref" href="C1.Win.TouchToolKit.ListViewZoomPolicy.ZoomBounds.html#C1_Win_TouchToolKit_ListViewZoomPolicy_ZoomBounds_System_Windows_Forms_Control_C1_Win_TouchToolKit_ZoomBoundsInfo_">ZoomBounds(Control, ZoomBoundsInfo)</a>
        </td>
        <td class="markdown level1 summary"><p>Zoom the control bounds.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Win_TouchToolKit_ListViewZoomPolicy_ZoomFont_System_Windows_Forms_Control_C1_Win_TouchToolKit_ZoomFontInfo_" data-uid="C1.Win.TouchToolKit.ListViewZoomPolicy.ZoomFont(System.Windows.Forms.Control,C1.Win.TouchToolKit.ZoomFontInfo)">
          <a class="xref" href="C1.Win.TouchToolKit.ListViewZoomPolicy.ZoomFont.html#C1_Win_TouchToolKit_ListViewZoomPolicy_ZoomFont_System_Windows_Forms_Control_C1_Win_TouchToolKit_ZoomFontInfo_">ZoomFont(Control, ZoomFontInfo)</a>
        </td>
        <td class="markdown level1 summary"><p>Zoom the control font.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h3 id="seealso">See Also</h3>
  <div class="seealso">
      <div><a class="xref" href="C1.Win.TouchToolKit.ZoomPolicy.html">ZoomPolicy</a></div>
  </div>

</div>
