在多台显示器指定启动窗口/表格位置 [英] Specifying startup window/form location on multiple displays
本文介绍了在多台显示器指定启动窗口/表格位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有两个显示器(两个显示器)连接到我的机器,我注意到一个奇怪的事情发生了今天。我有我的主显示屏上的资源管理器窗口与我编译的exe打开,当我双击它,它在主显示屏(左监视器)开幕。但是,如果我按下Enter键以启动可执行文件,它开始在副显示屏(右显示器)。初步形成的窗口状态是最大化。 ?有没有办法告诉C#来打开主显示屏的最初形式
I have two displays (two monitors) connected to my machine, and I noticed a strange thing happening today. I had an Explorer window open with my compiled exe on my primary display, and when I double-clicked it, it opened in the primary display (left monitor). However if I pressed enter to launch the executable, it started in the secondary display (right monitor). The window state of the initial form is maximized. Is there a way to tell C# to open the initial form in the primary display?
推荐答案
这应该做的伎俩:
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Form1 f = new Form1();
f.StartPosition = FormStartPosition.Manual;
f.Location = Screen.PrimaryScreen.Bounds.Location;
Application.Run(f);
}
这篇关于在多台显示器指定启动窗口/表格位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文