简体   繁体   中英

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. I have been looking for the past hour but can't seem to get an answer. In Java its a simple JFrame.getwidth(); but no so simple for c#?

using windows forms

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?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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