如何将鼠标滚轮支持添加到TGraphicControl下的组件? [英] How to add mouse wheel support to a component descended from TGraphicControl?
问题描述
我已经创建了一个从TGraphicControl下载的delphi组件。是否可以添加对鼠标滚轮的支持?
---编辑---
我已经暴露了MouseWheel事件,如下所示,但它们不被调用。
TMyComponent = class(TGraphicControl)
已发布
属性OnMouseWheel;
属性OnMouseWheelDown;
属性OnMouseWheelUp;
结束
---编辑---
如下所示,我试图捕获WM_MOUSEWHEEL和CM_MOUSEWHEEL消息,但它似乎不起作用。但是,我设法捕获CM_MOUSEENTER消息。我不明白为什么我可以捕获一种类型的消息,而不是其他消息。
I have created a delphi component which descends from TGraphicControl. Is it possible to add support for mouse wheels? --- Edit --- I've exposed the MouseWheel events as shown below but they aren't called. --- Edit --- As suggested below, I've tried to trap the WM_MOUSEWHEEL and CM_MOUSEWHEEL messages, but it doesn't seem to work. However I've managed to trap the CM_MOUSEENTER message. I don't understand why i can trap one type of message, but not the other. 这篇关于如何将鼠标滚轮支持添加到TGraphicControl下的组件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! TGraphicControl
从 TControl
,它已经具有鼠标滚轮支持。请参阅
wm_MouseWheel
消息, DoMouseWheel
, DoMouseWheelDown
, DoMouseWheelUp
和 MouseWheelHandler
方法,以及 WheelAccumulator
属性。 / p> TMyComponent = class(TGraphicControl)
published
property OnMouseWheel;
property OnMouseWheelDown;
property OnMouseWheelUp;
end;
TGraphicControl
descends from TControl
, which already has mouse-wheel support. See the wm_MouseWheel
message, the DoMouseWheel
, DoMouseWheelDown
, DoMouseWheelUp
, and MouseWheelHandler
methods, and the WheelAccumulator
property.