How to fix the event delay

前端 未结 2 823
余生分开走
余生分开走 2020-12-11 12:38

I\'m making a table reservation system for a school project, and I\'m using a list of PictureBoxes to represent the tables. To these PictureBoxes I have linked a hover event

相关标签:
2条回答
  • 2020-12-11 12:55

    everything works great, except that when i haver the mouse over, it takes 1 second before the event is triggered

    That's how Control.MouseHover is defined:

    Occurs when the mouse pointer rests on the control.

    The "rests" part is the delay of a second. I don't know of any way of adjusting the length of time that the mouse has to rest of a control before it counts as a hover.

    If you don't want any delay - i.e. you want an event which is raised as soon as the mouse enters the region of the control - you should be using Control.MouseEnter instead.

    From the documentation of both events:

    Mouse events occur in the following order:

    • MouseEnter

    • MouseMove

    • MouseHover / MouseDown / MouseWheel

    • MouseUp

    • MouseLeave

    0 讨论(0)
  • 2020-12-11 13:05

    If you want to trigger event immediately, use MouseEnter event instead. By design your mouse should stay stationary for some time for MouseHover event to fire.

    BTW SystemInformation.MouseHoverTime holds that delay for MouseHover event.

    0 讨论(0)
提交回复
热议问题