显示目标监视器

时间:2014-09-15 13:10:09

标签: c# winforms

不确定我在这里缺少什么。尝试在某些显示器上显示表单,但它们最终都在同一台显示器上。

private static List<Form> forms = new List<Form>();

public static void Run()
{
    foreach (Screen screen in Screen.AllScreens)
    {
        Image gfx = GetDesktop(screen);
        forms.Add(CreateForm(gfx, screen));
    }

    forms.ForEach(f => f.Show());
}

private static Form CreateForm(Image desktop, Screen screen)
{
    Form frm = new Form();
    frm.FormBorderStyle = FormBorderStyle.None;
    frm.BackgroundImage = desktop;
    frm.Location = screen.WorkingArea.Location;
    frm.WindowState = FormWindowState.Maximized;
    frm.TopMost = true;
    frm.ShowInTaskbar = false;
    return frm;
}

1 个答案:

答案 0 :(得分:3)

尝试frm.StartPosition = FormStartPosition.Manual;