c#对话框消息框-messagebox.show置顶方法
// MessageBox.Show("串口" + COMPort + "打开失败\r\nCOM端口选择正确吗?\r\n串口线连接了吗?\r\n" + e.StackTrace,"串口错误",MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
MessageBox.Show("串口" + COMPort + "打开失败\r\nCOM端口选择正确吗?\r\n串口线连接了吗?\r\n" + e.StackTrace, "串口错误", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification);
MessageBox.Show() 的第六个参数options 类型: System.Windows.Forms. MessageBoxOptions MessageBoxOptions 值之一,可指定将对消息框使用哪些显示和关联选项。 若要使用默认值,请传入 0。 成员名称 说明 ServiceNotification 消息框显示在活动桌面上。调用方是一种服务,用于将事件通知用户。 即使没有用 户登录到计算机,该功能也会在当前活动桌面上 显示一个消息框。 DefaultDesktopOnly 消息框显示在活动桌面上。 此常数与 ServiceNotification 相同,只是系统仅在交互窗口站的默认桌面上显示消息框。 DefaultDesktopOnly 将使引发 MessageBox 的应用程序失去焦点。 显示的 MessageBox 将不使用视觉 样式。 有关更多信息,请参见 使用视觉样式呈现控 件。 RightAlign 消息框文本右对齐。 RtlReading 指定消息框文本按从右到左的阅读顺序显示。