我有一個需要大約5秒才能完成的功能,我想在功能運行時顯示「等待」消息。在執行動作時顯示「等待」消息
這裏是我的代碼:
if (puntos_rectangulos_estereotaxia.Count == 4)
{
generar_puntos_rectangulo_por_imagen(); //This takes 5 seconds
}
我怎麼能顯示與文本彈出窗口中的「等待」?我試過一個消息框,但我的功能不運行,直到用戶點擊「OK」,因此,必須有另一種方式來做到這一點..
private void generar_puntos_rectangulo_por_imagen()
{
Point Inicial_izquierdo_inf = new Point(puntos_rectangulos_estereotaxia[0].X, puntos_rectangulos_estereotaxia[0].Y);
Point Inicial_derecho_sup = new Point(puntos_rectangulos_estereotaxia[1].X, puntos_rectangulos_estereotaxia[1].Y);
Point Final_izquierdo_inf = new Point(puntos_rectangulos_estereotaxia[2].X, puntos_rectangulos_estereotaxia[2].Y);
Point Final_derecho_sup = new Point(puntos_rectangulos_estereotaxia[3].X, puntos_rectangulos_estereotaxia[3].Y);
puntos_rectangulos_estereotaxia.Clear();
int wu = 24;
for (int i = 0; i < img.Count; ++i)
{
// Time consuming calculations
}
}
的WinForms?檢查出來[BackgroundWorker](http://msdn.microsoft.com/en-us/library/cc221403(v = vs.95).aspx) – jayvee 2014-10-01 14:36:42
我這個方法唯一的問題是,我有3或4時間消耗所以我需要爲每個人創建3或4個後臺工作人員,對嗎? – Matias 2014-10-01 21:57:59