获取窗体的宽度#

Getting the width of the form C#

我已将表单设置为全屏,并尝试将 widthheight 设为整数。我一直在寻找过去的一个小时,但似乎无法得到答案。在 Java 中它是一个简单的 JFrame.getwidth(); 但对于 c# 来说就没那么简单了?

使用 windows 表格

Screen可以帮助您获取尺码。

Screen.PrimaryScreen.Bounds.Width;
Screen.PrimaryScreen.Bounds.Height;
Screen.PrimaryScreen.Bounds.Size;

你也可以看看How to retrieve the Screen Resolution from a C# winform app?