Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Borderless Window monogame

I'm trying to port a XNA game to MonoGame. I only want to target Windows platform. I want to display the game in a borderless window. I do that, this way, in my XNA game:

private void SetForm()
    {
        Form myForm = (Form)Form.FromHandle(this.Window.Handle);
        myForm.Name = "WIPForm";            
        int width = 1024;
        int height = 768;           
        IntPtr auxptr = (this.Window.Handle);
        SafeNativeMethods.MoveWindow(
            (int)auxptr,
            0,
            0,
            Properties.Settings.Default.width,
            Properties.Settings.Default.height,
            1);
        myForm.FormBorderStyle = FormBorderStyle.None;
        myForm.SetBounds(0, 0, width, height);
    }

When I test this code in the monogame version myForm = null. Is there any way to draw a borderless window in the monogame version?

like image 760
fralurbe Avatar asked Nov 15 '25 02:11

fralurbe


1 Answers

In the constructor of your MonoGame game class:

set:

Window.IsBorderless = true;

As per: https://monogame.codeplex.com/discussions/432292

like image 56
Arthur Dent Avatar answered Nov 17 '25 21:11

Arthur Dent



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!