积极答复者
C# directx制作的播放器,怎么捕捉鼠标双击事件

问题
答案
-
不是的,如果你写在某个form里面,它只对当前form里起作用.
所以建议你把那个播放器的控件继承下,然后在里面加上如上代码,就可以捕获双击播放器的事件。
比如我在一个form里面加入一个继承自button的自定义控件。
点击任何地方都不会显示test,除了这个button。class mybutton :Button { protected override void WndProc(ref Message m) { if (m.Msg == 0x0203) { MessageBox.Show("test"); } base.WndProc(ref m); } }
Cookie Luo[MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
- 已标记为答案 Cookie Luo 2011年6月24日 1:38
全部回复
-
你好
你可以用下面的代码捕获鼠标的双击事件。
const int WM_LBUTTONDBLCLK = 0x0203; protected override void WndProc(ref Message m) { if (m.Msg == WM_LBUTTONDBLCLK) { //action } base.WndProc(ref m); }
Cookie Luo[MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
-
不是的,如果你写在某个form里面,它只对当前form里起作用.
所以建议你把那个播放器的控件继承下,然后在里面加上如上代码,就可以捕获双击播放器的事件。
比如我在一个form里面加入一个继承自button的自定义控件。
点击任何地方都不会显示test,除了这个button。class mybutton :Button { protected override void WndProc(ref Message m) { if (m.Msg == 0x0203) { MessageBox.Show("test"); } base.WndProc(ref m); } }
Cookie Luo[MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
- 已标记为答案 Cookie Luo 2011年6月24日 1:38