我嘗試在C#(WinForms)中每次在同一位置打開新窗口。 嘗試使用此代碼:窗口中StartPosition =手動打開後新窗口的位置
但結果
private void Notification_Load(object sender, EventArgs e)
{
Rectangle screenSize = Screen.PrimaryScreen.Bounds; //get resolution of screen
int x = screenSize.Height -115-30; //x coordinate = resolution of screen - window Height - 30 (for taskbar)
int y = screenSize.Width - 345; //y coordinate = resolution of screen - window Weight
this.SetDisplayRectLocation(x, y); //new coordinates for form
}
特性 - 有我總是在窗口左上角打開。
嘗試爲x和y設置不同的值 - 結果相同。
我做錯了什麼?
你爲什麼不設置'this.Left'和'this.Top'的值? – iabbott
爲什麼你的'x = Height'和'y = Width'? – Fabio