XNA and WinForms

2019-07-12 04:47发布

问题:

I was wondering If there was a way to have an xna game within a windows forms or in vice versa. I have found several examples online, but I couldn't understand what they were doing. I was also wondering if there was a way to make a sprite act like a button on a winforms...is it possible to click on a sprite?

回答1:

Yes, on all.

Sprite act like a button on winforms: use the onclick event

Xna Game within Windows Forms: You would need to add a reference to the Xna.framework.something ... sorry kinda out of touch which class implements it but a lot of examples on the xna forums by the community It should generate a toolbox control to be able to drag and drop. Example: Nick Gravelyn's Tile Editor... it's youtube based which take you through it step by step.

Winforms into Xna Game: I would say not to rely on adding a winform objects to xna games as it would not always work. e.g: running on xbox360 :D Though, it would be same thing as above for the answer. Examples: Winforms components into xna