我正在尝试显示 UltraMessageBox,当我使用单个显示器时它工作正常,但如果我将应用程序打开到第二个显示器,消息框将隐藏在第一个显示器中其他打开的应用程序后面。
是否有任何设置可以设置 UltraMessageBoxManager 以便打开的消息框显示在与应用程序相同的监视器中?
UltraMessageBoxInfo 类中有两个基本属性,允许您将消息框放置在您想要的任何位置(如果有多个监视器)。
起始位置
指定消息框的启动位置。这 仅当 StartPosition 属性为 设置为手动。
起始位置
指定对话框的初始位置。如果设置了枚举 到手动,则表单的位置由 StartLocation 属性。有关如何使用代码片段设置
StartPosition和StartLocation的更多信息,请访问https://www.infragistics.com/help/winforms/winmessageboxmanager-setting-up-the-startposition-and-startlocation-properties
不过,这就是——它应该在 14.x 上运行:
Assembly asm = Assembly.GetAssembly(typeof(Infragistics.Win.UltraMessageBox.UltraMessageBoxManager));
Type type = asm.GetType("Infragistics.Win.UltraMessageBox.MessageBoxDialog");
using (Form dialog = asm.CreateInstance(type.FullName) as Form)
{
MethodInfo mi = type.GetMethod("InitializeDialog",
BindingFlags.NonPublic | BindingFlags.Instance,
null,
new Type[] { ultraMessageBoxInfo.GetType() },
null);
object[] parameters = new object[] { ultraMessageBoxInfo };
mi.Invoke(dialog, parameters);
dialog.StartPosition = FormStartPosition.CenterParent;
}