Is it possible to use Buttons and other UI elements with XNA
Can you combine XNA and Windows Forms
And a Happy New Year

Re: XNA Framework Buttons and ...

Nick Darnell

No, you can not combine XNA and Windows Forms.

Yes you can use buttons and other UI elements in XNA, but just like with Direct X or OpenGL you have to either write them yourself or find a library. Except with the ~latest release of Direct X which comes with some built in UI components.

I'm working on a UI library as are a few other people, as is Microsoft for a future release of XNA.

Re: XNA Framework Buttons and ...

Ben Vanik

You can't mix them together, but you can do the traditional side-by-side - e.g., you have a viewport displaying your scene, and then some panels with buttons/etc on the side (like how most level editors/etc look). Search around on the forums here and you can probably find some code for setting it up; it's almost identical to how MDX did it.

An alternative is to have a separate window with your UI in it - this allows you to still use Game, although it's tricky unless you have experience with WinForms as you have to run the WinForms stuff in another thread and deal with a bunch of nasty invokes...

Re: XNA Framework Buttons and ...

Glenn Wilson

The DirectX SDK has had a GUI System for a while, well at least the last 4 to 5 years. The GUI System is included in the sample framework and is used in almost all of the samples.

You will find that several teams are working on a gui system for the XNA System, one you might like to look at is the text input system the guys over at are working on.