C#窗体的常用事件
Load                            ——窗体加载时事件
MouseClick                 ——在窗体中单击鼠标触发该事件
MouseDoubleClick     ——在窗体中双击鼠标触发该事件
MouseMove               ——在窗体中移动鼠标触发该事件
KeyDown                    ——键盘键按下时触发该事件
KeyUp                         ——键盘键释放时触发该事件

 

publicForm1()
{
InitializeComponent();
textBox1.Enter+=newEventHandler(textBox1_Enter);//获得焦点事件
textBox1.Leave+=newEventHandler(textBox1_Leave);//失去焦点事件。
}

void textBox1_Enter(object sender,EventArgs e)
{
MessageBox.Show("获得了焦点");
}

void textBox1_Leave(object sender,EventArgs e)
{
MessageBox.Show("失去了焦点");
}

  



 

相关文章:

  • 2021-12-29
  • 2021-12-19
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-19
  • 2022-12-23
猜你喜欢
  • 2022-01-15
  • 2021-12-19
  • 2021-12-19
  • 2022-12-23
  • 2022-12-23
  • 2021-07-02
相关资源
相似解决方案