作业要求
点击【显示】按钮,在标签空间中显示【hello world]
代码
namespace hello__world
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
textBox1.Text = "hello world";//在文本框中显示"hello world"
}
private void button2_Click(object sender, EventArgs e)
{
textBox1.Text = "";//将文本框内显示的内容清空
}
private void button3_Click(object sender, EventArgs e)
{
MessageBox.Show("hello world");//弹出一个新的对话框,显示"hello world"
}
}
}
效果

网友评论