using System;
using System.Windows.Forms;
namespace WindowsControlsDemo
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Demonstrating Windows Controls");
Console.WriteLine("1. Label");
Console.WriteLine("2. Button");
Console.WriteLine("3. TextBox");
Console.WriteLine("Enter your choice: ");
int choice = int.Parse(Console.ReadLine());
Form form = new Form();
switch (choice)
{
case 1:
Label label = new Label();
label.Text = "This is a Label control";
label.Location = new System.Drawing.Point(10, 10);
form.Controls.Add(label);
break;
case 2:
Button button = new Button();
button.Text = "Click me";
button.Location = new System.Drawing.Point(10, 10);
button.Click += new EventHandler(ButtonClick);
form.Controls.Add(button);
break;
case 3:
TextBox textBox = new TextBox();
textBox.Location = new System.Drawing.Point(10, 10);
form.Controls.Add(textBox);
break;
default:
Console.WriteLine("Invalid option. Try again.");
break;
}
Application.Run(form);
}
private static void ButtonClick(object sender, EventArgs e)
{
MessageBox.Show("Button was clicked");
}
}
}