在html里面,如何写鼠标按下不松开一直响应事件呀?
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了在html里面,如何写鼠标按下不松开一直响应事件呀?相关的知识,希望对你有一定的参考价值。
参考技术A 不懂你说的响应事件具体指的是啥?类似于拖拽效果?如果是这样的话addEventListener监听鼠标按下事件,然后计算鼠标位置,再触发响应的事件。如果是按下循环某一个事件的话,加个定时器为啥按下鼠标,拖动鼠标,然后松开鼠标时,对 WM_LBUTTONDOWN,程序有响应,但是对 WM_LBUTTON不响应?
代码如下:
case WM_LBUTTONDOWN:
var_Get( p_event->p_vout, "mouse-button-down", &val );
val.i_int |= 1;
var_Set( p_event->p_vout, "mouse-button-down", val );
PostMessage(p_event->p_vout->p_sys->hparent, WM_LBUTTONDOWN, msg.wParam, MAKELPARAM(pt.x, pt.y));
if(hwnd != 0)
PostMessage(hwnd, WM_LBUTTONDOWN, msg.wParam, MAKELPARAM(pt.x, pt.y));
DirectXPopupMenu( p_event, false );
break;
case WM_LBUTTONUP:
var_Get( p_event->p_vout, "mouse-button-down", &val );
val.i_int &= ~1;
var_Set( p_event->p_vout, "mouse-button-down", val );
var_SetBool( p_event->p_vout, "mouse-clicked", true );
PostMessage(p_event->p_vout->p_sys->hparent, WM_LBUTTONUP, msg.wParam, MAKELPARAM(pt.x, pt.y));
if(hwnd != 0)
PostMessage(hwnd, WM_LBUTTONUP, msg.wParam, MAKELPARAM(pt.x, pt.y));
break;
以上是关于在html里面,如何写鼠标按下不松开一直响应事件呀?的主要内容,如果未能解决你的问题,请参考以下文章
MFC的静态控件怎么响应鼠标事件呀。。要详细一点的。。我菜鸟,谢谢
为啥按下鼠标,拖动鼠标,然后松开鼠标时,对 WM_LBUTTONDOWN,程序有响应,但是对 WM_LBUTTON不响应?