1、在界面上添加一个 PictureBox ,设置好 PictureBox 的图片为动态图片GIF
2、设置DataGridView中添加DataGridViewImageColumn的一列来显示图片,设置 单元格的图片为PictureBox .Image
3、重绘单元格实现动态图片的显示(通过一个定时器来刷新单元格的内容)
简单代码如下:这只是变通方法
Timer time = new Timer();
private void btuStart_Click(object sender, EventArgs e)
{
pictureBox1.Image = Image.FromFile(@"C:UsersMnycDesktop257.GIF");
dgvSteps.Rows.Add();
this.dgvSteps.Rows[0].Cells[0].Value = pictureBox1.Image;
time.Tick += time_Tick;
time.Interval = 40;
time.Enabled = true;
}
void time_Tick(object sender, EventArgs e)
{
if (this.dgvSteps.Rows.Count > 0)
{
this.dgvSteps.InvalidateCell(0, 0);
}
}
private void btuEnd_Click(object sender, EventArgs e)
{
time.Enabled = false;
}