【发布时间】:2016-07-24 04:03:51
【问题描述】:
我目前正在制作一个带有 Doubleclick 事件的无边框表单以最大化表单。但我意识到表单不会在其他两个屏幕上最大化,只有我的主要中间。 所以我的代码目前是:
private void Form1_DoubleClick(object sender, EventArgs e)
{
if ((this.Height == Screen.PrimaryScreen.WorkingArea.Height) && (this.Width == Screen.PrimaryScreen.WorkingArea.Width))
{
this.Width = 534;
this.Height = 600;
CenterToScreen();
}
else
{
this.Height = Screen.PrimaryScreen.WorkingArea.Height;
this.Width = Screen.PrimaryScreen.WorkingArea.Width;
this.Location = Screen.PrimaryScreen.WorkingArea.Location;
}
}
它可能看起来很奇怪,但我用它来不覆盖任务栏。 我需要这样的代码将其停靠在一边,并使用它来计算表单的位置。看起来像这样:half right screen dock 当我单击这 9 个按钮之一时,它会将屏幕停靠在屏幕的不同位置。在角落、屏幕的一半或中间。
我尝试使用一个代码来让表单检测它在哪个屏幕上,然后再次使用它来最大化该屏幕上的表单,但是我得到了一堆红线,最终它没有工作。
我有 3 台显示器。
请帮忙。
【问题讨论】:
标签: c# monitor maximize multiple-monitors borderless