我的程序上有一个图片框,我正在使用MouseLeave和MouseEnter来检测鼠标进入和离开图片框的时间。但是如果我快速移动鼠标,MouseEnter和MouseLeave就不是很精确。我需要更精确的东西,所以我想要使用计时器来检测鼠标进入和离开图片框的时间。但是如何在该计时器中使用MouseEnter和MouseLeave事件?
private: System::Void pictureBox1_MouseLeave(System::Object^ sender, System::EventArgs^ e) {
label1->Text = "The mouse has left the picturebox";
}
private: System::Void pictureBox1_MouseEnter(System::Object^ sender, System::EventArgs^ e) {
label1->Text = "The mouse has entered the picturebox";
}
private: System::Void timer1_Tick(System::Object^ sender, System::EventArgs^ e) {
//insert pictureBox1_MouseLeave event here
//insert pictureBox1_MouseEnter event here
}