MainDialog is the type of your windows main form, that needs to implement IXnaFormContainer
//Form1 is the standard winform when a new WindowsForms application is created
public partial Form1 : Form, IXnaFormContainer{
//YourControl is some control placed on your form. I'm guessing a Panel will work
public Control XnaControl { get{return this.YourControl} }
//Game1 is your XNA game class
private XnaControlGame _game;
public XnaControlGame Game { get{return _game;} set{_game=value;} }
}
In the next step you need to alter your Game1
class
public class Game1 : XnaControlGame{ //instead of Microsoft.Xna.Framework.Game
public Game1 ( IntPtr handle, System.Windows.Forms.Form parentForm, System.Windows.Forms.Control surfaceControl) : base(handle, parentForm, surfaceControl){
...
}
}
In the static void main
static void Main(string[] args){
XnaControlGame.CreateAndShow<Form1, Game1>( );
}