简体   繁体   English

获取表格C#的宽度

[英]Getting the width of the form C#

I have set my form to be full screen and trying to get the width and the height as an integer. 我将表单设置为全屏,并尝试将widthheight作为整数获取。 I have been looking for the past hour but can't seem to get an answer. 我一直在找过去的一个小时,但似乎找不到答案。 In Java its a simple JFrame.getwidth(); 在Java中,它是一个简单的JFrame.getwidth(); but no so simple for c#? 但是对于C#来说没有那么简单吗?

using windows forms 使用Windows表单

The Screen can help you to get the size. 屏幕可以帮助您获取尺寸。

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

You can also have a look on How to retrieve the Screen Resolution from a C# winform app? 您还可以查看如何从C#winform应用程序检索屏幕分辨率?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM