Files
stgsharp/源代码/Demo/Project1/NewFolder1/CodeFile1.cs
T
2022-05-06 01:45:42 +08:00

38 lines
933 B
C#

using System;
using System.Windows;
using System.Windows.Forms;
namespace FormDemo
{
class Program
{
static void Main()
{
MyForm MainForm = new MyForm("Main Waindow");
MainForm.ShowDialog();
}
}
class MyForm : Form
{
private Button NewButton;
private TextBox Output;
public MyForm(string FormName)
{
Form NewForm = new Form();
this.Text= FormName;
this.Output=new TextBox();
this.NewButton = new Button();
this.Controls.Add(this.NewButton);
this.Controls.Add(this.Output);
this.NewButton.Text = "ShowHello";
this.NewButton.Top = 20;
this.NewButton.Click += ButtonClicked;
}
private void ButtonClicked(object sender, EventArgs e)
{
this.Output.Text = "Hello World";
}
}
}