ImageAnimator 클래스를 이용해서 비트맵과 프레임변경 핸들러를 추가하면
ImageAnimator.UpdateFrames()를 통해 다음 프레임을 원하는대로 그리는 듯
투명도 되려나?
using System;
using System.Drawing;
using System.Windows.Forms;
namespace BackgroundWorkerTest
{
public partial class SandGlass : Form
{
public SandGlass()
{
InitializeComponent();
this.StartPosition = FormStartPosition.CenterScreen;
}
Bitmap bit;
protected override void OnLoad(EventArgs e)
{
bit = new Bitmap("sandglass.gif");
ImageAnimator.Animate(bit, new EventHandler(this.OnFrameChanged));
base.OnLoad(e);
}
protected override void OnPaint(PaintEventArgs e)
{
ImageAnimator.UpdateFrames();
Graphics g = pictureBox1.CreateGraphics();
g.DrawImage(this.bit, new Point(0, 0));
base.OnPaint(e);
}
private void OnFrameChanged(object sender, EventArgs e)
{
this.Invalidate();
}
}
}
[링크 : https://blog.naver.com/goldrushing/130184365511]
[링크 : https://docs.microsoft.com/en-us/dotnet/api/system.drawing.imageanimator.animate?view=dotnet-plat-ext-3.1]