C# Thread+GIF+Dialog 實作等待動畫
C# Thread+GIF+Dialog 實作等待動畫
GITHUB URL : https://github.com/jash-git/CS_Animation_Thread
public void createThreadAnimation(String StrMsg, ParameterizedThreadStart fun)//執行多執行序和顯示等待動畫
{
ProgressDialog d = new ProgressDialog();
Thread t = new Thread(fun);
t.Start(d);
d.StartPosition = FormStartPosition.CenterParent;
d.m_strMessage = StrMsg;
d.ShowDialog();
}
public void Thread_function(object arg)//執行序
{
ProgressDialog d = (ProgressDialog)arg;
….do something….
d.Invoke(new Action(d.Close));
}
————
createThreadAnimation(“Dialog Message”, Thread_function);
//ps ProgressDialog包含一個GIF動畫和一個文字標籤