Sign in to follow this  
deadlydog

Can you use Windows Forms in XNA?

Recommended Posts

deadlydog    170
I am thinking of moving to using XNA and am wondering if it is possible to use the Windows Forms Controls in an XNA project. The reason I want to do this is simply that I don't want to have to build a user interface within my game/demo; I would like to use simple controls, such as checkboxes, combo boxes, etc which are already part of the Windows Forms. I was able to do this using managed DirectX simply by having DirectX draw to a panel, instead of the entire window. Is this possible in XNA? If it is not possible (or XNA does not have a similar feature) I will just stick with using managed DirectX and C# for now instead of switching to XNA just yet. Thanks

Share this post


Link to post
Share on other sites
Spodi    642
No prob, Bob. When it comes to XNA stuff, I recommend always just at least skimming the sight real quick. There may not be a lot of content, but for what they do have, its of pretty great quality. :)

Share this post


Link to post
Share on other sites
MJP    19755
Yeah that sample Spodi posted should get you started. What it does is really simple: instead of using the Xna.Framework.Game class (which is completely optional), it just creates a GraphicsDeviceService that creates a graphics device and implements IGraphicsDeviceService (so that the ContentManager class can locate the GraphicsDevice). Doing things without the Game class really isn't that hard, in fact I ditched the Game class for my actual game project so I could have the flexibility I wanted. It also allows me to more easily interface my common engine framework with both my map editor and my game.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this