相关疑难解决方法(0)

当应用程序最小化到托盘时,C#MessageBox到前面

我有一些弹出消息框的代码:

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);
Run Code Online (Sandbox Code Playgroud)

我的问题是当弹出我的应用程序通常最小化到托盘.因此,消息框不会出现在前面,也不会出现在起始栏中.看到它的唯一方法是通过alt-tabbing.

以下代码可以最小化我的应用程序(父级)到托盘:

if (FormWindowState.Minimized == WindowState)
{                
      Hide();                
}
Run Code Online (Sandbox Code Playgroud)

.net c# system-tray messagebox winforms

8
推荐指数
3
解决办法
1万
查看次数

标签 统计

.net ×1

c# ×1

messagebox ×1

system-tray ×1

winforms ×1