Borderless window doesn't allow me to make the window as large as the screen

I am making a game in MonoGame, I set the game to be borderless 1920x1080 ( my display ) but the window is always around 40 pixels shorter than my display. When I set the window height to be a bit longer than my maximum it doesn’t change anything at all. What do I do?

Which platform are you developing on? I think OpenGL behaves differently than Direct3D here. Can you also provide a code snippet of how you’re doing it?

(...) public const int ScreenWidth = 1920; public const int ScreenHeight = 1080; (...)

GraphicsDeviceManager = new GraphicsDeviceManager(this) { // SupportedOrientations = DisplayOrientation.Default, // Phone Display Orientation SynchronizeWithVerticalRetrace = false, // Sync with vsync // PreferredDepthStencilFormat = DepthFormat.Depth24Stencil8, // 32 bit colour depth PreferredBackBufferWidth = ScreenWidth, // Width of output PreferredBackBufferHeight = ScreenHeight, // Height of output // PreferredBackBufferFormat = SurfaceFormat.Rgba64, // Format of output PreferMultiSampling = false, // Multisampling disabled HardwareModeSwitch = true, // Hard switch from fullscreen to window IsFullScreen = false, // Fullscreen GraphicsProfile = GraphicsProfile.HiDef // HD as game is computer-exclusive }; GraphicsDeviceManager.ApplyChanges();

When I use GraphicsDevice.Viewport.Width to draw some text on the screen, for example the Y Position would be GraphicsDevice.Viewport.Height - 40, the text is drawn outside the bounds. FYI: Yes, I checked the code, there is nothing that causes it inside my code

Here is how my window looks:

Try setting IsFullscreen to true. In combination with HardwareModeSwitch = false that does what you want i.e. borderless window at desktop resolution. You shouldn’t set that manually because MonoGame centers the window in the area without the task bar on Windows IIRC.

But I want to drag the window around, I just want the resolution to be at 1920x1080, is that possible without hacky code?

You’re not setting the window size with the backbuffer width and height, you’re setting the client width and height, the part of the window that MonoGame can render to. To set the window size you’d have to subtract the size of the window decoration from the resolution before passing it to MonoGame. But what’s the point of letting users drag the window around if it covers the entire sceen?

Hello @vxern, welcome to the forums, Happy coding!