tangxu
2024-12-29 72e75456f8b30ec5b6f355539d9c883b0f810d21
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
using System;
using System.Drawing;
 
namespace Microsoft.Windows.Forms.Animate
{
    /// <summary>
    /// 动画帧
    /// </summary>
    internal sealed class AnimationFrame : DisposableMini
    {
        private AnimationFrameType m_FrameType;
        /// <summary>
        /// 获取帧类型
        /// </summary>
        public AnimationFrameType FrameType
        {
            get
            {
                return this.m_FrameType;
            }
        }
 
        private object m_Value;
        /// <summary>
        /// 帧值,通常为图片或颜色
        /// </summary>
        public object Value
        {
            get
            {
                return this.m_Value;
            }
        }
 
        /// <summary>
        /// 创建一个颜色帧
        /// </summary>
        /// <param name="color">颜色</param>
        public AnimationFrame(Color color)
        {
            this.m_Value = color;
            this.m_FrameType = AnimationFrameType.Color;
        }
 
        /// <summary>
        /// 创建一个图像帧
        /// </summary>
        /// <param name="image">图像</param>
        public AnimationFrame(Image image)
        {
            this.m_Value = image;
            this.m_FrameType = AnimationFrameType.Image;
        }
 
        /// <summary>
        /// 释放资源
        /// </summary>
        /// <param name="disposing">释放托管资源为true,否则为false</param>
        protected override void Dispose(bool disposing)
        {
            if (this.m_Value != null)
            {
                IDisposable disposable = this.m_Value as IDisposable;
                if (disposable != null)
                    disposable.Dispose();
                this.m_Value = null;
            }
        }
    }
}