可能重复:
在WinForms中嵌入XNA
嘿,请注意这个帖子不是重复的.它是因为你无法得到任何答案,因为它的链接不起作用...有人评论我,他有新的链接,当我看到该网站,它不是我需要...
我正在制作需要登录的游戏,我想在WinForm中登录...但是当我运行winform然后在成功登录后它应该运行游戏.我在StackOverflow上看过这个帖子,但回答的链接是... abanonded ...
XNA是在自举中引导的Program.cs.只需在客户端通过身份验证即可启动XNA游戏时在winforms中添加代码Program.cs.
见http://www.codeproject.com/Questions/303672/XNA-And-Windows-forms
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
button1.Text = "Start!";
}
private void button1_Click(object sender, EventArgs e)
{
Thread theThread = new Thread(StartGame);
theThread.Start();
}
public void StartGame()
{
Game1 game = new Game1();
game.Run();
}
}
Run Code Online (Sandbox Code Playgroud)