C#的MessageBox要接待当应用程序最小化到托盘 [英] C# MessageBox To Front When App is Minimized To Tray
本文介绍了C#的MessageBox要接待当应用程序最小化到托盘的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一些code的弹窗消息框:
的MessageBox.show(这一点,
你没有输入用户名和密码。你想现在配置您的设置?,
设置所需,
MessageBoxButtons.YesNo,
MessageBoxIcon.Question);
我的问题是,当这种弹出我的应用程序通常是最小化到托盘。其结果是,消息框不会到前面来,它也犯规一起出现的开始吧。看到它的唯一方法是ALT-Tab键。
下面是code表示托盘最大限度地减少我的应用程序(父):
如果(FormWindowState.Minimized ==的WindowState)
{
隐藏();
}
解决方案
您可以尝试像这样
的MessageBox.show(新表(){最顶层=真},你还没有输入用户名和密码。你想现在配置您的设置?,
设置所需,
MessageBoxButtons.YesNo,
MessageBoxIcon.Question);
I have some code that popups a message box:
MessageBox.Show(this,
"You have not inputted a username or password. Would you like to configure your settings now?",
"Settings Needed",
MessageBoxButtons.YesNo,
MessageBoxIcon.Question);
My problem is when this pops up my app is usually minimized to the tray. As a result the messagebox doesn't come to the front and it also doesnt appear along the start bar. The only way of seeing it is by alt-tabbing.
Here is the code that minimizes my app (the parent) to the tray:
if (FormWindowState.Minimized == WindowState)
{
Hide();
}
解决方案
you can try like this
MessageBox.Show(new Form() { TopMost = true }, "You have not inputted a username or password. Would you like to configure your settings now?",
"Settings Needed",
MessageBoxButtons.YesNo,
MessageBoxIcon.Question);
这篇关于C#的MessageBox要接待当应用程序最小化到托盘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文