Embed MonoGame into Winform.

I personally love winform. Here is code to embed MonoGame into a winform. It was for XNA but works with MonoGame. I did not originate this code. It was from XNA Creatures Club forum but it’s gone now so I can’t credit the original poster. I use this method mainly to create a level editor. Maybe some here can find this example useful.

English is my second language. Hope everyone can understand.

bangclash/WinformMonoGame (github.com)

1 Like

Looks cool. I will definitely look at this for an editor, this sounds crazzzy

I can’t even imagine how this would work … I have programmed a lot of monogame projects, and a lot of winforms projects, and both are a very different experience to me.

1 Like

Feel free to check out the MonoGame.Forms project:

It was built to jumpstart the editor creation process.

Cheers

1 Like

This is rediculous. lol. When I heard of monogame forms, I just assumed it was forms WITHIN my monogame app… O … M… G…

So which is better of the two options presented here?

I downloaded and tried both.
WinformMonoGame is a small example solution which worked immediately in Visual Studio 2019.
So it’s like a proof of concept - good if you want to have a play around.

Monogame.Forms is a much more comprehensive package which did not work when I tried to open it in either VS 2017 or 2019 (e.g. it did not recognise the documentation project).

@SandboxBlizz does it need to be upgraded for monogame 3.8 or did I miss something?

1 Like

I believe that was the original intent of WinfromMonoGame. Simple code to allow anyone to expand on it and do what they want.

You can savely remove the documentation project from the solution.

The documentation project not loading does not affect the build as you point out.

I had one other issue which was the MainWindow.resx was throwing a build error indicating that it was sourced from the web so VS2019 refused to build it.

I fixed this by editing the properties of the file and hitting the Unblock button at the bottom.

After that I had a clean build (apart from the documentation project).