[]
        
(Showing Draft Content)

C1.Win.TouchToolKit.C1Zoom.Controls

Controls Property

Controls

Gets the child controls of the owner form.

Declaration
[Browsable(false)]
public Control.ControlCollection Controls { get; }
Property Value
Type Description
Control.ControlCollection

The Control.ControlCollection value that represents the child controls of the owner form.

Remarks

After form loaded, C1Zoom will change all child controls from form to a inner panel. So, if a form attached to a C1Zoom, user should use GcZoom.Controls property instead of Form.Controls property.

Examples

The following code example shows how to use this method.

public class GcZoomControlsDemo : Form
{
	private GcZoom _gcZoom1 = new GcZoom();
	private Button _controlsButton;
	private Button _changeChildControlButton;

	public GcZoomControlsDemo()
	{
		InitializeComponent();

		_gcZoom1.Target = this;

		_controlsButton.Click += _controlsButton_Click;
		_changeChildControlButton.Click += _changeChildControlButton_Click;
	}

	void _controlsButton_Click(object sender, EventArgs e)
	{
		foreach (Control item in _gcZoom1.Controls)
		{
			Console.WriteLine(item.ToString());
		}
	}

	void _changeChildControlButton_Click(object sender, EventArgs e)
	{
		Button newButton = new Button();
		newButton.Text = "New Button";
		newButton.Location = new Point(100, 100);
		newButton.Size = new Size(this.Size.Width / 2, this.Size.Height / 2);

		_gcZoom1.BeginAddControls();
		_gcZoom1.Controls.Add(newButton);
		_gcZoom1.EndAddControls();
	}

 	private void InitializeComponent()
 	{
		_controlsButton = new Button();
		_controlsButton.Text = "Controls";
		_controlsButton.Location = new Point(20, 130);
		_controlsButton.Size = new Size(120, 25);

		_changeChildControlButton = new Button();
		_changeChildControlButton.Text = "ChangeChildControl";
		_changeChildControlButton.Location = new Point(20, 190);
		_changeChildControlButton.Size = new Size(120, 25);

		this.Controls.Add(_controlsButton);
		this.Controls.Add(_changeChildControlButton);
 	}
}
Public Class GcZoomControlsDemo
	Inherits Form
	Private _gcZoom1 As New GcZoom()
	Private _controlsButton As Button
	Private _changeChildControlButton As Button

	Public Sub New()
		InitializeComponent()

		_gcZoom1.Target = Me

		AddHandler _controlsButton.Click, AddressOf _controlsButton_Click
		AddHandler _changeChildControlButton.Click, AddressOf _changeChildControlButton_Click
	End Sub

 	Private Sub _controlsButton_Click(sender As Object, e As EventArgs)
	 	For Each item As Control In _gcZoom1.Controls
		 	Console.WriteLine(item.ToString())
	 	Next
 	End Sub

 	Private Sub _changeChildControlButton_Click(sender As Object, e As EventArgs)
	 	Dim newButton As New Button()
	 	newButton.Text = "New Button"
	 	newButton.Location = New Point(100, 100)
	 	newButton.Size = New Size(Me.Size.Width \ 2, Me.Size.Height \ 2)

	 	_gcZoom1.BeginAddControls()
	 	_gcZoom1.Controls.Add(newButton)
	 	_gcZoom1.EndAddControls()
 	End Sub

 	Private Sub InitializeComponent()
		_controlsButton = New Button()
	 	_controlsButton.Text = "Controls"
		_controlsButton.Location = New Point(20, 130)
		_controlsButton.Size = New Size(120, 25)

	 	_changeChildControlButton = New Button()
	 	_changeChildControlButton.Text = "ChangeChildControl"
	 	_changeChildControlButton.Location = New Point(20, 190)
	 	_changeChildControlButton.Size = New Size(120, 25)

	 	Me.Controls.Add(_controlsButton)
	 	Me.Controls.Add(_changeChildControlButton)
	End Sub
End Class