[SOLVED]Hiding the title bar

I’ve just got a very simple, seemingly foolish beginners question that’s driving me batty. How do you hide the title bar of the default window that is provided when you start a new Monogame windows project?

Try:

yourGame.Window.IsBorderless = true;

And you have to provide some other way to exit the game then, besides the now vanished X-button :slight_smile:

2 Likes

That worked, thanx - I figured it’d be something simple like that…I must’ve scoured the internet for a half an hour without seeing anything on it, though. And yes, I had already mapped the escape key to exit for me, I’m not quite as inept as I made myself appear with this question…; )

2 Likes

LOL. I know the feeling.
Didn’t want to offend :smiley: Mentioned it because it happened to me while trying the solution :blush: keep on coding.

1 Like

Oh. Please change the title to:

[SOLVED] Hiding the title bar

Thx

What about keeping the border but removing the titlebar? Things look ugly on Windows without the border. In fact its not really much of a border, but there is a nice shadow effect that disappears when you set Window.IsBorderless to true.

You’ll have to delve into the Win32 API for this. There’s a lot of stuff you can use to set various properties on the window using the handle. I believe you can get the handle from MonoGame’s Window class via one of the properties, or a function on the property.

Keep in mind that if cross platform is a thing you intend to worry about, you’ll need to consider how other operating systems handle these scenarios (if they even do) and structure your code accordingly. For just Windows though, totally doable.

I did a bit of googling to see if I could find some starting points. SetWindowLong might be what you’re looking for, but honestly, google "Win32 API " and you should get some hits. Also, stick “pinvoke” at the beginning of your search too. That site has a lot of great integrations with C#, and folks have provided handy structs that you can use with the Win32 API calls so you don’t have to write them yourself :slight_smile: