I started some tools and studied the combination of xNa and winform. After studying several implementations, I became familiar with winform and found that the implementation on the Internet was not good.
So I made a minimum implementation of modifying the image.
Because the xNa default Template already has a game. Run. on Windows platform, there is no doubt that there is a main loop of window message processing. So any solution to build an app to put the game into the game is put before the horse, the problem is that everyone's implementation on the internet is like this ......
That's easy. You just need to create a tool window and show it. Then, it's OK. See figure 2 above.
Then merge the graphic window, which can be directly merged in game. init.
Then, when the tool exits, if you do not need to separate it, do nothing. Exit the separation status tool.ProgramExit.
Resetdevice is required when merging State size changes. Well, it's perfect, and there is no other work.
These are two functions added to game.
This is automatically merged during game initialization.
This is added in the tool window.Code