Form tells wrong size on Windows 8 — how to get real size?

前端 未结 2 1356
抹茶落季
抹茶落季 2020-12-10 08:07

Having a WinForms form with form border style set to Sizable on Windows 8, the DesktopBounds property tells the correct values:

2条回答
  •  独厮守ぢ
    2020-12-10 08:39

    I don't think "wrong" is quite the right way to put it.. you are seeing values you don't understand, but that's not always the same as wrong. The real question is what is the actual problem you are trying to solve by getting the window bounds?

    Have you tried the Win32 GetWindowRect method? I wonder what that shows.

    One hack you could try would be to detect the OS and account for these.

    To determine the OS in C#: http://support.microsoft.com/kb/304283 (that sample doesn't mention Windows 8 specifically, but I assume the SDK has been updated for it)

提交回复
热议问题