/* * A simple C# program that displays some text in a window. * Compile with: "csc hello-world-gui.cs" * Run with: "hello-world-gui" * * Ben Bederson, January 16, 2002 */ using System; using System.Drawing; using System.Windows.Forms; public class HelloWorldGUI : System.Windows.Forms.Form { public HelloWorldGUI() { Text = "Hello world!"; BackColor = Color.White; // Create a "label" control Label label = new Label(); label.Text = "Hello world!"; label.ForeColor = Color.Blue; label.Font = new Font("Arial", 24, FontStyle.Bold); label.AutoSize = true; // Insert the label into the window Controls.Add(label); } public static void Main() { Application.Run(new HelloWorldGUI()); } }