[]
public event EventHandler<C1ZoomAttachingEventArgs> C1ZoomAttaching
Type | Description |
---|---|
EventHandler<C1ZoomAttachingEventArgs> | Occurs when the component is preparing attach to a . |
You can change the initial settings of C1Zoom component in this event's event handler.
You can cancel current attaching operation by set Cancel property to true.
The following code example shows how to use this event.
This code example is part of a larger example provided for the C1ApplicationZoom class.
public class GcApplicationZoomDemo : Form
{
private Button _showForm2Button;
private GcApplicationZoom _gcApplicationZoom;
public GcApplicationZoomDemo()
{
InitializeComponent();
_showForm2Button.Click += _showForm2Button_Click;
_gcApplicationZoom.GcZoomAttaching += _gcApplicationZoom_GcZoomAttaching;
}
void _gcApplicationZoom_GcZoomAttaching(object sender, GcZoomAttachingEventArgs e)
{
// May be some forms should not be zoom.
if (e.Form is NormalForm)
{
e.Cancel = true;
}
else
{
e.GcZoom.AutoShowControl = true;
}
}
void _showForm2Button_Click(object sender, EventArgs e)
{
Form form = new NormalForm();
form.Show();
}
private void InitializeComponent()
{
_gcApplicationZoom = new GcApplicationZoom();
_showForm2Button = new Button();
_showForm2Button.Text = "Click to open NormalForm";
_showForm2Button.Location = new Point(20, 80);
_showForm2Button.Size = new Size(200, 40);
this.Controls.Add(_showForm2Button);
}
}
internal class NormalForm : Form
{
private Button _showFormButton;
public NormalForm()
{
InitializeComponent();
_showFormButton.Click += _showFormButton_Click;
}
void _showFormButton_Click(object sender, EventArgs e)
{
Form form = new NormalForm();
form.Show();
}
private void InitializeComponent()
{
_showFormButton = new Button();
_showFormButton.Text = "Click to open a new form";
_showFormButton.Location = new Point(20, 20);
_showFormButton.Size = new Size(200, 40);
this.Controls.Add(_showFormButton);
this.Text = "NormalForm";
}
}
Public Class GcApplicationZoomDemo
Inherits Form
Private _showForm2Button As Button
Private _gcApplicationZoom As GcApplicationZoom
Public Sub New()
InitializeComponent()
AddHandler _showForm2Button.Click, AddressOf _showForm2Button_Click
AddHandler _gcApplicationZoom.GcZoomAttaching, AddressOf _gcApplicationZoom_GcZoomAttaching
End Sub
Private Sub _gcApplicationZoom_GcZoomAttaching(sender As Object, e As GcZoomAttachingEventArgs)
' May be some forms should not be zoom.
If TypeOf e.Form Is NormalForm Then
e.Cancel = True
Else
e.GcZoom.AutoShowControl = True
End If
End Sub
Private Sub _showForm2Button_Click(sender As Object, e As EventArgs)
Dim form As Form = New NormalForm()
form.Show()
End Sub
Private Sub InitializeComponent()
_gcApplicationZoom = New GcApplicationZoom()
_showForm2Button = New Button()
_showForm2Button.Text = "Click to open NormalForm"
_showForm2Button.Location = New Point(20, 80)
_showForm2Button.Size = New Size(200, 40)
Me.Controls.Add(_showForm2Button)
End Sub
End Class
Friend Class NormalForm
Inherits Form
Private _showFormButton As Button
Public Sub New()
InitializeComponent()
AddHandler _showFormButton.Click, AddressOf _showFormButton_Click
End Sub
Private Sub _showFormButton_Click(sender As Object, e As EventArgs)
Dim form As Form = New NormalForm()
form.Show()
End Sub
Private Sub InitializeComponent()
_showFormButton = New Button()
_showFormButton.Text = "Click to open a new form"
_showFormButton.Location = New Point(20, 20)
_showFormButton.Size = New Size(200, 40)
Me.Controls.Add(_showFormButton)
Me.Text = "NormalForm"
End Sub
End Class