0

我的程序上有一个图片框,我正在使用 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
             }
4

0 回答 0