using System.Collections;
using System.Collections.Generic;
using System.Drawing;
namespace Microsoft.Windows.Forms.Animate
{
///
/// 动画操作集合
///
internal class AnimationOperations : DisposableMini, IEnumerable
{
//操作集合
private List m_Frames = new List();
private bool m_Cleared;
///
/// 获取是否清空关键帧
///
public bool Cleared
{
get
{
return this.m_Cleared;
}
}
private Size? m_Size;
///
/// 获取要改变的大小
///
public Size Size
{
get
{
return this.m_Size.Value;
}
}
///
/// 获取是否要改变大小
///
public bool Resized
{
get
{
return this.m_Size != null;
}
}
///
/// 改变大小操作
///
/// 要改变的大小
public void Resize(Size size)
{
this.m_Size = size;
}
///
/// 添加关键帧操作
///
/// 关键帧
public void AddFrame(AnimationFrame frame)
{
this.m_Frames.Add(frame);
}
///
/// 清空关键帧操作
///
public void ClearFrame()
{
foreach (AnimationFrame frame in this.m_Frames)
frame.Dispose();
this.m_Frames.Clear();
this.m_Cleared = true;
}
///
/// 使用完毕,清空操作
///
public void Clear()
{
this.m_Frames.Clear();
this.m_Cleared = false;
this.m_Size = null;
}
///
/// 获取枚举器
///
/// 枚举器
public IEnumerator GetEnumerator()
{
return this.m_Frames.GetEnumerator();
}
///
/// 获取枚举器
///
/// 枚举器
IEnumerator IEnumerable.GetEnumerator()
{
return (this.m_Frames as IEnumerable).GetEnumerator();
}
///
/// 释放资源
///
/// 释放托管资源为 true,否则为 false
protected override void Dispose(bool disposing)
{
if (this.m_Frames != null)
{
foreach (AnimationFrame frame in this.m_Frames)
frame.Dispose();
this.m_Frames.Clear();
this.m_Frames = null;
}
}
}
}