我使用全屏設置C# - 最大限度地提高我的表格後,寬度和高度值返回錯誤
this.WindowState = FormWindowState.Maximized;
執行它之後,我想形式的新的寬度和高度,但當我使用this.width這個高度時,它只是返回在最大化之前設置的值。
這裏是我的代碼:
this.WindowState = FormWindowState.Maximized;
g.DrawImage(app.Properties.Resources.bg, 0, 0, Screen.GetWorkingArea(this).Width, Screen.GetWorkingArea(this).Height);
可能需要[ActualWidth的(https://msdn.microsoft.com/en-us/library/system.windows.frameworkelement.actualwidth(v = vs.110).aspx)和[ActualHeight](https://msdn.microsof t.com/zh-cn/library/system.windows.frameworkelement.actualheight(v=vs.110).aspx) – Grundy
我沒有看到你在哪裏使用this.Width和this.Height。你在哪裏調用這個代碼?你的表單是否有邊框?發佈重複問題的代碼。 – LarsTech
該代碼是Graffitos回答後編輯的代碼。之前我通常用這個來試試.Width – Joey