Is there a simpler way to create a borderless window with XNA 4.0?

Posted by Cypher on Game Development See other posts from Game Development or by Cypher
Published on 2012-09-15T22:01:14Z Indexed on 2012/09/16 3:53 UTC
Read the original article Hit count: 324

Filed under:
|
|

When looking into making my XNA game's window border-less, I found no properties or methods under Game.Window that would provide this, but I did find a window handle to the form.

I was able to accomplish what I wanted by doing this:

IntPtr hWnd = this.Window.Handle;
var control = System.Windows.Forms.Control.FromHandle( hWnd );
var form = control.FindForm();
form.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;

I don't know why but this feels like a dirty hack. Is there a built-in way to do this in XNA that I'm missing?

© Game Development or respective owner

Related posts about XNA

Related posts about c#