Desktop app - Incorrect window size in windowed mode

Hi,

I am in an advanced state in my Windows desktop game and I just realized that when I am running my game in windowed mode (graphics.IsFullScreen = false;) the rendering window’s size is absolutely wrong. My laptop’s actual resolution is 1920x1080, and setting the prefferedbackbuffersize to 1680x1050 the window almost completly fills my screen, moreover, the height of the window exceeds the limit of my screen. In fullscreen mode, everything is fine.

At first I thought that I am doing something wrong, so I tried it with a brand new Windows Desktop project, Monogame 3.4 and only set the preferredbackbuffer size and the IsFullScreen properties to what I mentioned. I tried it in:

  • the game’s constructor
  • the init method
  • the load method
  • the update method
    with ApplySettings() of course, and still the size is totally wrong.

I tried it on my work PC as well, with the same full HD resolution, but with a 24" monitor, and the result is the same. What else is missing? I tried the window’s borderless property as well, the result was the same, so the problem has nothing to do with the borders.

Has anyone else experienced the same? It looks very amateur if the game does not properly resizes its rendering window when in windowed mode and I would not release the game until this error is solved. Thanks!

1680x1050 is close to 1920x1080
You are sure the window is wrong size? about 100 pixel left and right would be the right size. In height the difference is only 15 pixel (- border).
Which size has you window? You can take a screenshot (near to F12 at a common keyboard) and measure it in a painting program.

Omg, I forgot to add, that this behaviour happens only when you run the game by starting the executable!!! So not when running the game from Visual Studio! Sorry, I should drink less alcohol…or more! :smile:

This picture is made from the two different results (fullscreen screenshots):