Automatically close messagebox in C#

前端 未结 3 2016
终归单人心
终归单人心 2020-12-29 10:00

I am currently developing an application in C# where I display a MessageBox. How can I automatically close the message box after a couple of seconds?

3条回答
  •  情深已故
    2020-12-29 10:55

    The System.Windows.MessageBox.Show() method has an overload which takes an owner Window as the first parameter. If we create an invisible owner Window which we then close after a specified time, it's child message box would close as well.

    Here is the complete answer: https://stackoverflow.com/a/20098381/2190520

提交回复
热议问题