# Strange anomalies when using WinForms with XNA

I haven't seen any questions related to my issue, and this leads me to believe I'm missing something minor, however;

The Problem

I'm creating a game that is effectively launched from a windows form. Consider the following code.

static void Main(string[] args) {
main = new TestGame(); // The Game class.

while (true) {
main.RunGame( /* Some params */ );
} else {
ExitGame();
break;
}
}
}
}


This loop works fine. My issue lies in the form itself. Firstly, DialogResult does not trigger at all. When the result from menu.ShowDialog() is printed, its result is "Cancel" which is not the option set for the button (OK.) As well as this, picture boxes, the form background colour and other such controls do not work properly. And the form appears to have a UI style from Windows versions before or during XP. Is this a known issue or am I missing something?

• What does menu.ShowDialog() do? Shouldn't this logic be in some kind of OnButtonClick in the Form? – Alex H Aug 14 '15 at 9:29
• @AlexH It shows the form as a dialog box, or in other words it blocks the thread until the form is closed. This is so we can assign DialogResult values to buttons in order to tell a conditional what we want to do with the data we've entered. – Daaksin Aug 14 '15 at 9:53