C# 如何强制在双显示器系统的主显示器上显示闪屏?

发布于 2024-09-19 21:03:47 字数 323 浏览 5 评论 0原文

在具有两个显示器的系统中显示启动屏幕时,我遇到了问题。当我在主显示器中启动应用程序,然后在显示启动屏幕之前将鼠标指针移动到第二个显示器时,我的启动屏幕“跟随”鼠标指针。这意味着,启动画面显示在第二个显示器中,完成工作后,启动画面消失,应用程序显示在主显示器中。这看起来很丑陋而且不专业。

我尝试在表单的属性中设置属性 FormStartPosition.CenterScreen ,并在运行时在表单的构造函数中设置它,但这些都不起作用。顺便说一句,我正在使用 C#。

有什么提示可以实现启动画面与我的应用程序显示在同一监视器中吗?

任何帮助将不胜感激。

问候, 胜利者

I'm facing a problem when displaying a splash screen in a system with two monitors. When I start the application in the primary display, and then the mouse pointer is moved to the second monitor before the splash screen is shown, my splash screen "follows" the mouse pointer. That means, the splash screen is shown in the 2nd display and after it finishes its work, dissapears and the application is displayed in the primary monitor. This looks pretty ugly and unprofessional.

I have tried to set the property FormStartPosition.CenterScreen in the form's properties and set it in run time in the constructor of my form but none of this has worked. By the way, I'm using C#.

Any hints to achieve that the splash screen be displayed in the same monitor as my application?

Any help will bee deeply appreciated.

Greetings,
Victor

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

讽刺将军 2024-09-26 21:03:47

在 Main 中,您需要强制表单在主监视器上启动。下面介绍了如何在主显示器上打开 (0, 0) 处的表单。

    [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);
    }

In Main, you need to force the form to start on the primary monitor. Here's how to open a form at (0, 0) on the primary monitor.

    [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);
    }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文