【发布时间】:2012-08-02 15:45:51
【问题描述】:
我的 XNA 游戏中有以下代码:
private void gameOver()
{
if (!m_IsGameOver)
{
string message = String.Format("GAME OVER!!!{0}Your score is: {1}",
Environment.NewLine, GameScore);
if (MessageBox.Show(message, "GameOver", MessageBoxButtons.OK) == DialogResult.OK)
{
this.Exit();
}
m_IsGameOver = true;
}
}
private void gameWon()
{
string message = String.Format("You Won!!!{0}Your score is: {1}",
Environment.NewLine, GameScore);
if (MessageBox.Show(message, "You Won!", MessageBoxButtons.OK) == DialogResult.OK)
{
this.Exit();
}
}
由于某种原因,我收到以下错误:
"The name 'MessageBox' does not exist in the current context"
"The name 'MessageBoxButtons' does not exist in the current context"
"The name 'DialogResult' does not exist in the current context"
我正在尝试添加“System.Windows...”,但似乎“System”中没有“windows”...
我该如何解决这个问题?
【问题讨论】:
-
我不知道,我现在才这样做 :)
-
为什么要混合使用 XNA 和 WinForms 库?您应该通过游戏界面显示消息,而不是使用 MessageBox。
标签: c# xna xna-4.0 messagebox dialogresult