[]
Call this method after change child control collection.
public void EndAddControls()
The following code example shows how to use this method.
This code example is part of a larger example provided for the Controls property.
public class GcZoomControlsDemo : Form
{
private GcZoom _gcZoom1 = new GcZoom();
private Button _changeChildControlButton;
public GcZoomControlsDemo()
{
InitializeComponent();
_gcZoom1.Target = this;
_changeChildControlButton.Click += _changeChildControlButton_Click;
}
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()
{
_changeChildControlButton = new Button();
_changeChildControlButton.Text = "ChangeChildControl";
_changeChildControlButton.Location = new Point(20, 190);
_changeChildControlButton.Size = new Size(120, 25);
this.Controls.Add(_changeChildControlButton);
}
}
Public Class GcZoomControlsDemo
Inherits Form
Private _gcZoom1 As New GcZoom()
Private _changeChildControlButton As Button
Public Sub New()
InitializeComponent()
_gcZoom1.Target = Me
AddHandler _changeChildControlButton.Click, AddressOf _changeChildControlButton_Click
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()
_changeChildControlButton = New Button()
_changeChildControlButton.Text = "ChangeChildControl"
_changeChildControlButton.Location = New Point(20, 190)
_changeChildControlButton.Size = New Size(120, 25)
Me.Controls.Add(_changeChildControlButton)
End Sub
End Class