相关疑难解决方法(0)

在辅助监视器上显示Windows窗体?

我正在尝试在辅助监视器上设置Windows窗体,如下所示:

private void button1_Click(object sender, EventArgs e)
{
    MatrixView n = new MatrixView();
    Screen[] screens = Screen.AllScreens;
    setFormLocation(n, screens[1]);
    n.Show();
}

private void setFormLocation(Form form, Screen screen)
{
    // first method
    Rectangle bounds = screen.Bounds;
    form.SetBounds(bounds.X, bounds.Y, bounds.Width, bounds.Height);

    // second method
    //Point location = screen.Bounds.Location;
    //Size size = screen.Bounds.Size;

    //form.Left = location.X;
    //form.Top = location.Y;
    //form.Width = size.Width;
    //form.Height = size.Height;
}
Run Code Online (Sandbox Code Playgroud)

边界的属性似乎是正确的,但在我尝试的两种方法中,这最大化了主监视器上的表单.有任何想法吗?

c# multiple-monitors winforms setbounds

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

如何确保在双监视器方案中"附加"监视器上显示表单?

我有一个应用程序,其中有一个表单,我想在第二个屏幕上显示.

平均值如果应用程序在屏幕A上运行,当我单击菜单以显示表格时,它应显示在屏幕B上,如果应用程序在屏幕B上运行,当我单击菜单显示表格时,它应显示在屏幕A上.

c# multiple-monitors winforms

20
推荐指数
3
解决办法
6万
查看次数

标签 统计

c# ×2

multiple-monitors ×2

winforms ×2

setbounds ×1