イベントで一緒e.Graphics.DrawImage
に絵を描いています。フォームを更新するためForm_Paint()
にを使用します。Timer
問題は、アニメーションが点滅することです。更新に時間がかかりすぎているようですe
。PictureBox
フォーム内に2つあります。
アイデア?
アップデート:
public Bitmap Paint(int state, Graphics g)
{
this.state = state;
Bitmap temp;
Graphics tempGraphics;
temp = new Bitmap(45, 47, g);
tempGraphics = Graphics.FromImage(temp);
switch (state)
{
case 0:
tempGraphics.DrawImageUnscaled(img, x, y);
break;
case 1:
tempGraphics.DrawImageUnscaled(img, x, y - 42);
break;
}
}
これにより、スプライトをフォームに追加する前に準備されます。