Kaoru
Kaoru

Reputation: 2883

Create custom message box in c# for game

i wanted to make custom message box in c# for a game, what i know is the message box already built-in in the windows forms as like this:

enter image description here

and i wanted to make it like this to be used in my game:

enter image description here

and maybe this not related question, but what do you guys think if programmer make a game in c# using windows forms? If that is a bad idea, what other option do you have to create a game with c# and visual studio alone (alone means not using any software than that)

Upvotes: 2

Views: 1527

Answers (2)

pid
pid

Reputation: 11607

Quick and dirty solution:

Just use a normal form that you design at your hearts desire and name it AlertDialog. The Visual Studio built-in WindowsForm designer is well suited for this task. Then show it in a modal fashion when you need it:

class MainForm : Form
{
    // ... tons of beautiful game code

    public void Alert(string message)
    {
        AlertDialog dialog;

        dialog = new AlertDialog(message);
        dialog.ShowDialog(this);
    }
}

More here: ShowDialog.

Upvotes: 1

Oleksiy Martynov
Oleksiy Martynov

Reputation: 379

This is an answer to your second question: If you are looking to make a game with c# and visual studio alone and if you have no previous experience with game development, I would recommend using Microsoft's XNA framework. The reason is that it gives you the ability to learn and implement all the basics of 2d and 3d game development with ease and simplicity you would expect from microsofts framework. Keep in mind that XNA is no longer actively being developed by microsoft, but it is still a great tool for learning and practice purposes.

Upvotes: 1

Related Questions