I have found a way to simply make an XNA 4.0 game's window borderless. Here is the code from the article:
IntPtr hWnd = this.Window.Handle; var control = System.Windows.Forms.Control.FromHandle( hWnd ); var form = control.FindForm(); form.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; form.WindowState = System.Windows.Forms.FormWindowState.Maximized;
You add it to the Game's constructor and it works perfectly. I tested it on several Windows PCs and it's great: the game runs seemingly in full screen, even if you set the game's resolution lower/higher than your desktop one. The only issue I had with it is the fact that you need to provide positions for XNA's SpriteBatch methods (Draw and DrawString) in desktop resolution, not in game's resolution, while retrieving width/height from GraphicsDevice gives you the latter.
At the same time, DOTA 2 has borderless window option, but the game scales the window down, if your requested in-game resolution is lower than your desktop one. I wonder if they have a good reason for doing this?
I wanted to ask if this approach is safe to use on PC or can it be buggy occasionally? I would especially like to know if it will work with Windows XP as I don't have a pc with this system to test it.