![](https://iknow-base.cdn.bcebos.com/lxb/notice.png)
C# windows窗口程序显示两个按钮和一个文本框
1个回答
展开全部
往窗体中添加一个 label 两个Button 控件
添加两个按钮的单击事件,如下:
private void button1_Click(object sender, EventArgs e)
{
label1.Visible = true;
label1.Text = "努力学习C#";
label1.BackColor = Color.Blue;//背景颜色为蓝色
label1.Location = new Point(50, 50);//位置
}
private void button2_Click(object sender, EventArgs e)
{
label1.Text = "";
label1.Visible = false;//隐藏
label1.BackColor = Color.White;
}
添加两个按钮的单击事件,如下:
private void button1_Click(object sender, EventArgs e)
{
label1.Visible = true;
label1.Text = "努力学习C#";
label1.BackColor = Color.Blue;//背景颜色为蓝色
label1.Location = new Point(50, 50);//位置
}
private void button2_Click(object sender, EventArgs e)
{
label1.Text = "";
label1.Visible = false;//隐藏
label1.BackColor = Color.White;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询