我有一個DataGridView,其中第一列可以容納一個動畫gif(動畫加載圓)。爲了使動畫部分的工作,我使用的蜱每100ms和調用此方法SplitContainer裏面的DataGridView無法重畫
private void timGifAnimation_Tick(object sender, EventArgs e)
{
if(this.dataGridView1.Rows.Count > 0 && current >= 0 && current < this.dataGridView1.Rows.Count)
{
this.dataGridView1.Rows[current].Cells[0].Value = this.picProcessing.Image;
this.dataGridView1.InvalidateCell(0, current);
}
}
這工作就像一個魅惑的,直到我把我的DataGridView在SplitContainer的一個Forms.Timer。單元格不再通過調用InvalidateCell重新繪製,gif動畫工作的唯一時間是現在當窗口被調整大小或當我懸停在按鈕上時(懸停重繪一次,將鼠標移離按鈕重繪它再次)。調試時,上述方法仍然被調用,它不會重新繪製單元格。
包含gridview的面板的大小是否小於該面板的最小大小(在splitcontainer上設置)? – roken 2012-08-03 13:18:15