[]
Provides data for GcZoom.AnimationStarting event and GcZoomPanel.AnimationStarting.
public class AnimationStartingEventArgs : EventArgs
The following code example shows how to use this class to customize the animiation.
class GcZoomAnimationDemo : Form
{
private Button _scrollLeftBtn = new Button();
private Button _scrollRightBtn = new Button();
private Button _zoomInBtn = new Button();
private Button _zoomOutBtn = new Button();
private CheckBox _customizeDuringChB = new CheckBox();
private GcZoom _gcZoom1 = new GcZoom();
public GcZoomAnimationDemo()
{
InitializeComponent();
_gcZoom1.Target = this;
_scrollLeftBtn.Click += _scrollLeftBtn_Click;
_scrollRightBtn.Click += _scrollRightBtn_Click;
_zoomInBtn.Click += _zoomInBtn_Click;
_zoomOutBtn.Click += _zoomOutBtn_Click;
_gcZoom1.AnimationStarting += _gcZoom1_AnimationStarting;
_gcZoom1.AnimationCompleted += _gcZoom1_AnimationCompleted;
}
void _zoomOutBtn_Click(object sender, EventArgs e)
{
_gcZoom1.SetZoomFactor(1, true);
}
void _zoomInBtn_Click(object sender, EventArgs e)
{
_gcZoom1.SetZoomFactor(2, true);
}
void _scrollRightBtn_Click(object sender, EventArgs e)
{
_gcZoom1.SetScrollLocation(new Point(-1000, 0), true);
}
void _scrollLeftBtn_Click(object sender, EventArgs e)
{
_gcZoom1.SetScrollLocation(new Point(0, 0), true);
}
void _gcZoom1_AnimationStarting(object sender, AnimationStartingEventArgs e)
{
if (_customizeDuringChB.Checked)
{
e.Duration = e.Duration * 4; // Make the animation slower.
// e.Cancel = true; // If it is necessary, cancel the animation by this code.
}
Console.WriteLine("+++ _gcZoom1_AnimationStarting +++");
Console.WriteLine("CurrentScrollLocation: " + e.CurrentScrollLocation.ToString());
Console.WriteLine("CurrentZoomFactor: " + e.CurrentZoomFactor.ToString());
Console.WriteLine("TargetScrollLocation: " + e.TargetScrollLocation.ToString());
Console.WriteLine("TargetZoomFactor " + e.TargetZoomFactor.ToString());
}
void _gcZoom1_AnimationCompleted(object sender, EventArgs e)
{
Console.WriteLine("+++ _gcZoom1_AnimationCompleted +++");
}
private void InitializeComponent()
{
this.Size = new Size(300, 600);
this._scrollLeftBtn.Location = new System.Drawing.Point(12, 50);
this._scrollLeftBtn.Size = new System.Drawing.Size(260, 30);
this._scrollLeftBtn.Text = "Scroll Left";
this._scrollRightBtn.Location = new System.Drawing.Point(12, 100);
this._scrollRightBtn.Size = new System.Drawing.Size(260, 30);
this._scrollRightBtn.Text = "Scroll Right";
this._zoomInBtn.Location = new System.Drawing.Point(12, 150);
this._zoomInBtn.Size = new System.Drawing.Size(260, 30);
this._zoomInBtn.Text = "Zoom In";
this._zoomOutBtn.Location = new System.Drawing.Point(12, 200);
this._zoomOutBtn.Size = new System.Drawing.Size(260, 30);
this._zoomOutBtn.Text = "Zoom Out";
this._customizeDuringChB.Location = new System.Drawing.Point(12, 22);
this._customizeDuringChB.Size = new System.Drawing.Size(183, 17);
this._customizeDuringChB.Text = "Customize animtation during Time";
this.Controls.Add(this._customizeDuringChB);
this.Controls.Add(this._zoomOutBtn);
this.Controls.Add(this._scrollRightBtn);
this.Controls.Add(this._zoomInBtn);
this.Controls.Add(this._scrollLeftBtn);
}
}
Class GcZoomAnimationDemo
Inherits Form
Private _scrollLeftBtn As New Button()
Private _scrollRightBtn As New Button()
Private _zoomInBtn As New Button()
Private _zoomOutBtn As New Button()
Private _customizeDuringChB As New CheckBox()
Private _gcZoom1 As New GcZoom()
Public Sub New()
InitializeComponent()
_gcZoom1.Target = Me
AddHandler _scrollLeftBtn.Click, AddressOf _scrollLeftBtn_Click
AddHandler _scrollRightBtn.Click, AddressOf _scrollRightBtn_Click
AddHandler _zoomInBtn.Click, AddressOf _zoomInBtn_Click
AddHandler _zoomOutBtn.Click, AddressOf _zoomOutBtn_Click
AddHandler _gcZoom1.AnimationStarting, AddressOf _gcZoom1_AnimationStarting
AddHandler _gcZoom1.AnimationCompleted, AddressOf _gcZoom1_AnimationCompleted
End Sub
Private Sub _zoomOutBtn_Click(sender As Object, e As EventArgs)
_gcZoom1.SetZoomFactor(1, True)
End Sub
Private Sub _zoomInBtn_Click(sender As Object, e As EventArgs)
_gcZoom1.SetZoomFactor(2, True)
End Sub
Private Sub _scrollRightBtn_Click(sender As Object, e As EventArgs)
_gcZoom1.SetScrollLocation(New Point(-1000, 0), True)
End Sub
Private Sub _scrollLeftBtn_Click(sender As Object, e As EventArgs)
_gcZoom1.SetScrollLocation(New Point(0, 0), True)
End Sub
Private Sub _gcZoom1_AnimationStarting(sender As Object, e As AnimationStartingEventArgs)
If _customizeDuringChB.Checked Then
' Make the animation slower.
' e.Cancel = true; // If it is necessary, cancel the animation by this code.
e.Duration = e.Duration * 4
End If
Console.WriteLine("+++ _gcZoom1_AnimationStarting +++")
Console.WriteLine("CurrentScrollLocation: " & e.CurrentScrollLocation.ToString())
Console.WriteLine("CurrentZoomFactor: " & e.CurrentZoomFactor.ToString())
Console.WriteLine("TargetScrollLocation: " & e.TargetScrollLocation.ToString())
Console.WriteLine("TargetZoomFactor " & e.TargetZoomFactor.ToString())
End Sub
Private Sub _gcZoom1_AnimationCompleted(sender As Object, e As EventArgs)
Console.WriteLine("+++ _gcZoom1_AnimationCompleted +++")
End Sub
Private Sub InitializeComponent()
Me.Size = New Size(300, 600)
Me._scrollLeftBtn.Location = New System.Drawing.Point(12, 50)
Me._scrollLeftBtn.Size = New System.Drawing.Size(260, 30)
Me._scrollLeftBtn.Text = "Scroll Left"
Me._scrollRightBtn.Location = New System.Drawing.Point(12, 100)
Me._scrollRightBtn.Size = New System.Drawing.Size(260, 30)
Me._scrollRightBtn.Text = "Scroll Right"
Me._zoomInBtn.Location = New System.Drawing.Point(12, 150)
Me._zoomInBtn.Size = New System.Drawing.Size(260, 30)
Me._zoomInBtn.Text = "Zoom In"
Me._zoomOutBtn.Location = New System.Drawing.Point(12, 200)
Me._zoomOutBtn.Size = New System.Drawing.Size(260, 30)
Me._zoomOutBtn.Text = "Zoom Out"
Me._customizeDuringChB.Location = New System.Drawing.Point(12, 22)
Me._customizeDuringChB.Size = New System.Drawing.Size(183, 17)
Me._customizeDuringChB.Text = "Customize animtation during Time"
Me.Controls.Add(Me._customizeDuringChB)
Me.Controls.Add(Me._zoomOutBtn)
Me.Controls.Add(Me._scrollRightBtn)
Me.Controls.Add(Me._zoomInBtn)
Me.Controls.Add(Me._scrollLeftBtn)
End Sub
End Class
Name | Description |
---|---|
Cancel | Gets or sets a value indicating whether this animation is canceled. |
CurrentScrollLocation | Gets the current scroll location. |
CurrentZoomFactor | Gets the current zoom factor. |
Duration | Gets or sets the duration of animation. |
TargetScrollLocation | Gets the target scroll location. |
TargetZoomFactor | Gets the target zoom factor. |