```
private void Form1_Load(object sender, EventArgs e)
{
btn3.Enabled = true;
}
private void btn2_Click(object sender, EventArgs e)
{
this.Text = "我是按钮2控件";
btn3.Enabled = true;
}
private void btn3_Click(object sender, EventArgs e)
{
this.Text = "我是按钮3控件";
}
private void btn1_Click(object sender, EventArgs e)
{
this.Text = "按钮3变灰";
btn3.Enabled = false;
}
private void button1_Leave(object sender, EventArgs e)
{
//失去焦点时触发,对于按钮的失去焦点就是按下其他按钮后
button1.BackColor = Color.Red;
}
private void button1_Enter(object sender, EventArgs e)
{
//获取焦点时触发/对于按钮的焦点就是按下按钮后
button1.BackColor = Color.Gold;
}
private void button1_MouseHover(object sender, EventArgs e)
{
//鼠标悬停时触发(停留一定时间)
button1.BackColor = Color.Green;
}
private void button1_MouseLeave(object sender, EventArgs e)
{
//鼠标离开 离开的范围是控件大小的范围
button1.BackColor = Color.HotPink;
}
private void button1_MouseMove(object sender, MouseEventArgs e)
{
//鼠标滑过 从控件内部滑过任意位置
button1.BackColor = Color.LightBlue;
}
```
网友评论