方案1,自己再写个控件:tmyimage=class(timage)然后拦截WM_MOUSEWHEEL消息,自己再添加这2个事件,对消息值进行处理后分别触发对应的事件
方案2,在自己的form里拦截WM_MOUSEWHEEL,判断消息值,再对image做相应处理
消息参数含义如下:
WM_MOUSEWHEEL
fwKeys = LOWORD(wParam); // key flags
zDelta = (short) HIWORD(wParam); // wheel rotation
xPos = (short) LOWORD(lParam); // horizontal position of pointer
yPos = (short) HIWORD(lParam); // vertical position of pointer
Parameters
fwKeys
Value of the low-order word of wParam. Indicates whether various virtual keys are down. This parameter can be any combination of the following values:
Value Description
MK_CONTROL Set if the CTRL key is down.
MK_LBUTTON Set if the left mouse button is down.
MK_MBUTTON Set if the middle mouse button is down.
MK_RBUTTON Set if the right mouse button is down.
MK_SHIFT Set if the SHIFT key is down.
zDelta
The value of the high-order word of wParam. Indicates the distance that the wheel is rotated, expressed in multiples or divisions of WHEEL_DELTA, which is 120. A positive value indicates that the wheel was rotated forward, away from the user; a negative value indicates that the wheel was rotated backward, toward the user.
xPos
Value of the low-order word of lParam. Specifies the x-coordinate of the pointer, relative to the upper-left corner of the screen.
yPos
Value of the high-order word of lParam. Specifies the y-coordinate of the pointer, relative to the upper-left corner of the screen.
从别处抄一段中文翻译:
1.fwKeys= LOWORD(wParam),表明各种虚拟键是否按下,有如下值:
值
说明
MK_CONTROL
按下CTRL键
MK_LBUTTON
按下鼠标左键
MK_MBUTTON
按下鼠标中键
MK_RBUTTON
按下鼠标右键
MK_SHIFT
按下Shift键
2.zDelta = (short) HIWORD(wParam)
鼠标轮滚动的距离,如果向前则为正,向后为负。
3. xPos =(short) LOWORD(lParam)
yPos=(short) HIWORD(lParam)
鼠标的位置。