为什么不存在MouseWheel事件? [英] Why MouseWheel event does not exist ?

查看:467
本文介绍了为什么不存在MouseWheel事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我在Visual Studio 2008中创建了一个新的C#Windows应用程序,并将面板(从工具箱)添加到了表单.
但是,我没有看到Panel的MouseWheel事件.

Panel从Control派生,该控件确实具有MouseWheel事件.
那么为什么Panel没有MouseWheel事件呢?

谢谢!

Hello,

I created a new C# Windows Application in Visual Studio 2008, and added a Panel (from the Toolbox) to the Form.
But, I don''t see the MouseWheel event of the Panel.

Panel derives from Control, which does has the MouseWheel event.
So why Panel does not have the MouseWheel event ?

Thanks !

推荐答案

这是因为Panel用作容器并且没有得到关注.只有其中的控件才能获得焦点.因此,如果您在窗体中有一个Panel并在该窗体上执行MouseWheel,则将触发窗体的事件,而不是Panels.

如果面板内部的任何控件具有焦点,则将触发其鼠标滚轮事件.
That is because Panel is used as a container and it does not gets focussed. Only the controls inside it get focus. So, if you have a Panel in a form and do a MouseWheel on panel, form''s event will be fired and not the Panels.

In case any of the control inside panel has focus, it''s mouse wheel event will be fired.


我了解!
谢谢您的出色回答!
I understand !
Thank you for the great answer !


这篇关于为什么不存在MouseWheel事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆