# C1.Win.TouchToolKit.C1ZoomCommandProvider

## Content

<div class="doc-site-dotnet-api-container">



  <h1 id="C1_Win_TouchToolKit_C1ZoomCommandProvider" data-uid="C1.Win.TouchToolKit.C1ZoomCommandProvider" class="text-break">C1ZoomCommandProvider Class
</h1>
  <div class="markdown level0 summary"><p>Represents the component which can be attached to any existing UserControl,
and made all IButtonControl on current Usercontrol can be execute the <a class="xref" href="C1.Win.TouchToolKit.ZoomCommands.html">ZoomCommands</a>.</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="https://learn.microsoft.com/dotnet/api/system.marshalbyrefobject">MarshalByRefObject</a></div>
    <div class="level2"><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.componentmodel.component">Component</a></div>
    <div class="level3"><span class="xref">C1ZoomCommandProvider</span></div>
  </div>
  <div class="implements">
    <h5>Implements</h5>
    <div><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.componentmodel.icomponent">IComponent</a></div>
    <div><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.idisposable">IDisposable</a></div>
    <div><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.componentmodel.iextenderprovider">IExtenderProvider</a></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_C1ZoomCommandProvider_syntax">Syntax</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">[ToolboxBitmap(typeof(C1ZoomCommandProvider), &quot;ControlBarCommands.png&quot;)]
public class C1ZoomCommandProvider : Component, IComponent, IDisposable, IExtenderProvider</code></pre>
  </div>
  <div class="codewrapper">
    <pre><code class="lang-vbnet hljs">&lt;ToolboxBitmap(GetType(C1ZoomCommandProvider), &quot;ControlBarCommands.png&quot;)&gt;
Public Class C1ZoomCommandProvider
    Inherits Component
    Implements IComponent, IDisposable, IExtenderProvider</code></pre>
  </div>
  <h5 id="C1_Win_TouchToolKit_C1ZoomCommandProvider_remarks"><strong>Remarks</strong></h5>
  <div class="markdown level0 remarks"><p>
When attach <a class="xref" href="C1.Win.TouchToolKit.C1ZoomCommandProvider.html">C1ZoomCommandProvider</a> to current <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.windows.forms.usercontrol">UserControl</a>, all of IButtonControl
control will add a smarttag, the smartag contain a <a class="xref" href="C1.Win.TouchToolKit.ZoomCommands.html">ZoomCommands</a> item.
</p>
<p>
A <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.windows.forms.usercontrol">UserControl</a> can't attach two or more <a class="xref" href="C1.Win.TouchToolKit.C1ZoomCommandProvider.html">C1ZoomCommandProvider</a> component.
</p>
</div>
  <h5 id="C1_Win_TouchToolKit_C1ZoomCommandProvider_examples"><strong>Examples</strong></h5>
  <p>
  The following code example shows how to use the <a class="xref" href="C1.Win.TouchToolKit.C1ZoomCommandProvider.html">C1ZoomCommandProvider</a> component.
</p>
<pre><code class="lang-csharp">public class ControlBarDemo : Form
{
	private Button _controlBarButton;
	private MyUserControl _userControl = new MyUserControl();
	private GcZoom _gcZoom1 = new GcZoom();

	public ControlBarDemo()
	{
		InitializeComponent();

		_gcZoom1.Target = this;

		// Create ControlBar
		AddControlBar();
	}

	private void AddControlBar()
	{
		ControlBar controlBar = new ControlBar();

		// Content should is a Type of UserControl.
		controlBar.Content = _userControl.GetType();

		controlBar.PositionMode = PositionMode.Floating;

		// Only take effect when Position Mode is Dock.
		// controlBar.DockPosition = ContentAlignment.MiddleCenter;
		// controlBar.Margin = new System.Windows.Forms.Padding();

		// Only take effect when PositionMode is Fix or Flowing.
		controlBar.Position = new Point(20, 20);

		controlBar.Opacity = 1d;
		controlBar.TransparentBackground = true;

		_gcZoom1.ControlBars.Add(controlBar);
	}

	private void InitializeComponent()
	{
		_controlBarButton = new Button();
		_controlBarButton.Text = "This is a Button";
		_controlBarButton.Location = new Point(100, 100);
		_controlBarButton.Size = new Size(120, 30);
		this.Controls.Add(_controlBarButton);
	}
}

public class MyUserControl : UserControl
{
	private GcZoomCommandProvider commands = new GcZoomCommandProvider();
	private Button _zoomInButton;
	private Button _zoomOutButton;
	private Button _getButton;

	public MyUserControl()
	{
		InitializeComponent();

		commands.Target = this;
		commands.SetZoomCommands(_zoomInButton, ZoomCommands.ZoomIn);
		Console.WriteLine(commands.GetZoomCommands(_zoomInButton).ToString());

		commands.SetZoomCommands(_zoomOutButton, ZoomCommands.ZoomOut);
		Console.WriteLine(commands.GetZoomCommands(_zoomOutButton).ToString());

		_getButton.Click += _getButton_Click;
	}

	void _getButton_Click(object sender, EventArgs e)
	{
		Console.WriteLine(commands.OwnerForm.ToString());
		Console.WriteLine(commands.OwnerGcZoom.ToString());
	}

	private void InitializeComponent()
	{
		_zoomInButton = new Button();
		_zoomInButton.Text = "+";
		_zoomInButton.Size = new Size(40, 40);
		_zoomInButton.Location = new Point(10, 10);

		_zoomOutButton = new Button();
		_zoomOutButton.Text = "_";
		_zoomOutButton.Size = new Size(40, 40);
		_zoomOutButton.Location = new Point(60, 10);

		_getButton = new Button();
		_getButton.Text = "Get";
		_getButton.Size = new Size(40, 40);
		_getButton.Location = new Point(110, 10);

		this.Size = new Size(160, 60);
		this.Controls.Add(_zoomInButton);
		this.Controls.Add(_zoomOutButton);
		this.Controls.Add(_getButton);
	}
}</code></pre>
<pre><code class="lang-csharp">Public Class ControlBarDemo
	Inherits Form
	Private _controlBarButton As Button
	Private _userControl As New MyUserControl()
	Private _gcZoom1 As New GcZoom()

	Public Sub New()
		InitializeComponent()

		_gcZoom1.Target = Me

		' Create ControlBar
		AddControlBar()
	End Sub

	Private Sub AddControlBar()
		Dim controlBar As New ControlBar()

		' Content should is a Type of UserControl.
		controlBar.Content = _userControl.[GetType]()
		controlBar.PositionMode = PositionMode.Floating

		' Only take effect when Position Mode is Dock.
		' controlBar.DockPosition = ContentAlignment.MiddleCenter;
		' controlBar.Margin = new System.Windows.Forms.Padding();

		' Only take effect when PositionMode is Fix or Flowing.
		controlBar.Position = New Point(20, 20)

		controlBar.Opacity = 1.0
		controlBar.TransparentBackground = True

		_gcZoom1.ControlBars.Add(controlBar)
	End Sub

	Private Sub InitializeComponent()
		_controlBarButton = New Button()
		_controlBarButton.Text = "This is a Button"
		_controlBarButton.Location = New Point(100, 100)
		_controlBarButton.Size = New Size(120, 30)
		Me.Controls.Add(_controlBarButton)
	End Sub
End Class

Public Class MyUserControl
	Inherits UserControl
	Private commands As New GcZoomCommandProvider()
	Private _zoomInButton As Button
	Private _zoomOutButton As Button
	Private _getButton As Button

	Public Sub New()
 		InitializeComponent()

		commands.Target = Me
		commands.SetZoomCommands(_zoomInButton, ZoomCommands.ZoomIn)
		Console.WriteLine(commands.GetZoomCommands(_zoomInButton).ToString())

		commands.SetZoomCommands(_zoomOutButton, ZoomCommands.ZoomOut)
		Console.WriteLine(commands.GetZoomCommands(_zoomOutButton).ToString())

		AddHandler _getButton.Click, AddressOf _getButton_Click
	End Sub

	Private Sub _getButton_Click(sender As Object, e As EventArgs)
		Console.WriteLine(commands.OwnerForm.ToString())
		Console.WriteLine(commands.OwnerGcZoom.ToString())
	End Sub

	Private Sub InitializeComponent()
 		_zoomInButton = New Button()
 		_zoomInButton.Text = "+"
 		_zoomInButton.Size = New Size(40, 40)
 		_zoomInButton.Location = New Point(10, 10)

 		_zoomOutButton = New Button()
 		_zoomOutButton.Text = "_"
 		_zoomOutButton.Size = New Size(40, 40)
 		_zoomOutButton.Location = New Point(60, 10)

 		_getButton = New Button()
 		_getButton.Text = "Get"
 		_getButton.Size = New Size(40, 40)
 		_getButton.Location = New Point(110, 10)

 		Me.Size = New Size(160, 60)
 		Me.Controls.Add(_zoomInButton)
 		Me.Controls.Add(_zoomOutButton)
 		Me.Controls.Add(_getButton)
	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_C1ZoomCommandProvider__ctor" data-uid="C1.Win.TouchToolKit.C1ZoomCommandProvider.#ctor">
          <a class="xref" href="C1.Win.TouchToolKit.C1ZoomCommandProvider.-ctor.html#C1_Win_TouchToolKit_C1ZoomCommandProvider__ctor">C1ZoomCommandProvider()</a>
        </td>
        <td class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="C1.Win.TouchToolKit.C1ZoomCommandProvider.html">C1ZoomCommandProvider</a> class.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Win_TouchToolKit_C1ZoomCommandProvider__ctor_System_ComponentModel_IContainer_" data-uid="C1.Win.TouchToolKit.C1ZoomCommandProvider.#ctor(System.ComponentModel.IContainer)">
          <a class="xref" href="C1.Win.TouchToolKit.C1ZoomCommandProvider.-ctor.html#C1_Win_TouchToolKit_C1ZoomCommandProvider__ctor_System_ComponentModel_IContainer_">C1ZoomCommandProvider(IContainer)</a>
        </td>
        <td class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="C1.Win.TouchToolKit.C1ZoomCommandProvider.html">C1ZoomCommandProvider</a> class.</p>
</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_C1ZoomCommandProvider_OwnerForm" data-uid="C1.Win.TouchToolKit.C1ZoomCommandProvider.OwnerForm">
          <a class="xref" href="C1.Win.TouchToolKit.C1ZoomCommandProvider.OwnerForm.html#C1_Win_TouchToolKit_C1ZoomCommandProvider_OwnerForm">OwnerForm</a>
        </td>
        <td class="markdown level1 summary"><p>Gets the form that owns this <a class="xref" href="C1.Win.TouchToolKit.ControlBar.html">ControlBar</a>.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Win_TouchToolKit_C1ZoomCommandProvider_OwnerGcZoom" data-uid="C1.Win.TouchToolKit.C1ZoomCommandProvider.OwnerGcZoom">
          <a class="xref" href="C1.Win.TouchToolKit.C1ZoomCommandProvider.OwnerGcZoom.html#C1_Win_TouchToolKit_C1ZoomCommandProvider_OwnerGcZoom">OwnerGcZoom</a>
        </td>
        <td class="markdown level1 summary"><p>Gets the <a class="xref" href="C1.Win.TouchToolKit.C1Zoom.html">C1Zoom</a> that owns this <a class="xref" href="C1.Win.TouchToolKit.C1ZoomCommandProvider.html">C1ZoomCommandProvider</a>.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Win_TouchToolKit_C1ZoomCommandProvider_Site" data-uid="C1.Win.TouchToolKit.C1ZoomCommandProvider.Site">
          <a class="xref" href="C1.Win.TouchToolKit.C1ZoomCommandProvider.Site.html#C1_Win_TouchToolKit_C1ZoomCommandProvider_Site">Site</a>
        </td>
        <td class="markdown level1 summary"><p>Gets or sets the <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.componentmodel.isite">ISite</a> of the <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.componentmodel.component">Component</a>.</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_C1ZoomCommandProvider_AboutBox" data-uid="C1.Win.TouchToolKit.C1ZoomCommandProvider.AboutBox">
          <a class="xref" href="C1.Win.TouchToolKit.C1ZoomCommandProvider.AboutBox.html#C1_Win_TouchToolKit_C1ZoomCommandProvider_AboutBox">AboutBox()</a>
        </td>
        <td class="markdown level1 summary"><p>Shows the product information window.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Win_TouchToolKit_C1ZoomCommandProvider_CanExtend_System_Object_" data-uid="C1.Win.TouchToolKit.C1ZoomCommandProvider.CanExtend(System.Object)">
          <a class="xref" href="C1.Win.TouchToolKit.C1ZoomCommandProvider.CanExtend.html#C1_Win_TouchToolKit_C1ZoomCommandProvider_CanExtend_System_Object_">CanExtend(object)</a>
        </td>
        <td class="markdown level1 summary"><p>Specifies whether this object can provide its extender properties to the specified object.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Win_TouchToolKit_C1ZoomCommandProvider_Dispose_System_Boolean_" data-uid="C1.Win.TouchToolKit.C1ZoomCommandProvider.Dispose(System.Boolean)">
          <a class="xref" href="C1.Win.TouchToolKit.C1ZoomCommandProvider.Dispose.html#C1_Win_TouchToolKit_C1ZoomCommandProvider_Dispose_System_Boolean_">Dispose(bool)</a>
        </td>
        <td class="markdown level1 summary"><p>Releases the unmanaged resources used by the <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.componentmodel.component">Component</a> and optionally releases the managed resources.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Win_TouchToolKit_C1ZoomCommandProvider_GetZoomCommands_System_Windows_Forms_IButtonControl_" data-uid="C1.Win.TouchToolKit.C1ZoomCommandProvider.GetZoomCommands(System.Windows.Forms.IButtonControl)">
          <a class="xref" href="C1.Win.TouchToolKit.C1ZoomCommandProvider.GetZoomCommands.html#C1_Win_TouchToolKit_C1ZoomCommandProvider_GetZoomCommands_System_Windows_Forms_IButtonControl_">GetZoomCommands(IButtonControl)</a>
        </td>
        <td class="markdown level1 summary"><p>Retrieves the <a class="xref" href="C1.Win.TouchToolKit.C1ZoomCommandProvider.html">C1ZoomCommandProvider</a> associated with the specified <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.windows.forms.ibuttoncontrol">IButtonControl</a> or not.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Win_TouchToolKit_C1ZoomCommandProvider_SetZoomCommands_System_Windows_Forms_IButtonControl_C1_Win_TouchToolKit_ZoomCommands_" data-uid="C1.Win.TouchToolKit.C1ZoomCommandProvider.SetZoomCommands(System.Windows.Forms.IButtonControl,C1.Win.TouchToolKit.ZoomCommands)">
          <a class="xref" href="C1.Win.TouchToolKit.C1ZoomCommandProvider.SetZoomCommands.html#C1_Win_TouchToolKit_C1ZoomCommandProvider_SetZoomCommands_System_Windows_Forms_IButtonControl_C1_Win_TouchToolKit_ZoomCommands_">SetZoomCommands(IButtonControl, ZoomCommands)</a>
        </td>
        <td class="markdown level1 summary"><p>Associates <a class="xref" href="C1.Win.TouchToolKit.C1ZoomCommandProvider.html">C1ZoomCommandProvider</a> with the specified <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.windows.forms.ibuttoncontrol">IButtonControl</a>.</p>
</td>
      </tr>
    </tbody>
  </table>

</div>
