Add a new form into your project and write Wait
on it, and then show that form whenever you need to show wait message to user.
For example your new form name is PopUp
. Create its instance before that method, and dispose it later:
if (puntos_rectangulos_estereotaxia.Count == 4)
{
PopUp popup = new PopUp(); //create instance
popup.Show(); //display popup
generar_puntos_rectangulo_por_imagen(); //This takes 5 seconds
popup.Dispose(); //close popup
}
Additional:
You can also update the message shown. Create a method in Popup
class:
public void SetMessage(string message)
{
this.lblMessage.Text = message;
}
Invoke:
if (puntos_rectangulos_estereotaxia.Count == 4)
{
PopUp popup = new PopUp(); //create instance
popup.SetMessage("Wait ! It'll take few seconds to complete."); //set message
popup.Show(); //display popup
generar_puntos_rectangulo_por_imagen(); //This takes 5 seconds
popup.Dispose(); //close popup
}
2
solved Show “Wait” message while performing an action [closed]