我在C#中開發了一個簡單的Windows應用程序(MDI),它將數據從SQL導出到Excel。執行長進程時在Windows窗體中的GIF動畫
我正在使用ClosedXML來實現這一目標。
當執行過程時,我想顯示包含動畫GIF圖像的圖片框。
我是初學者,不知道如何做到這一點,圖片框出現後的過程完成。
我看到很多帖子說使用backgroundworker或線程,我從來沒有使用過,發現很難實現。
我可以有一個一步一步的例子與解釋。
我創建的兩個函數是我在執行代碼之前和之後調用的。
private void Loading_On()
{
Cursor.Current = Cursors.WaitCursor;
pictureBox2.Visible = true;
groupBox1.Enabled = false;
groupBox5.Enabled = false;
groupBox6.Enabled = false;
Cursor.Current = Cursors.Arrow;
}
private void Loading_Off()
{
Cursor.Current = Cursors.Arrow;
pictureBox2.Visible = false;
groupBox1.Enabled = true;
groupBox5.Enabled = true;
groupBox6.Enabled = true;
Cursor.Current = Cursors.WaitCursor;
}
我已經使用線程成功顯示圖片框,但組框未禁用。 –