鼠标滚动按钮事件 [英] Mouse Scroll button event

查看:94
本文介绍了鼠标滚动按钮事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我想将鼠标滚动按钮向前滚动时将鼠标光标更改为加号,而将鼠标滚动按钮向后滚动时将鼠标光标更改为减号.

我正在使用Visual Studio 2008进行开发.

首先,我想知道如何获取鼠标滚动事件.
请指导我



i want to change the mouse cursor in to plus sign when the mouse scroll button is scrolled forward and mouse cursor into minus sign when the mouse scroll button is scrolled backward.

i am using visual studio 2008 for development.

first of all i want to know how can i get the mouse scroll event.
please guide me

推荐答案


尝试此代码.我尚未测试过,但它应该可以工作

try this code. i haven''t tested it,but it should work

//assuming u r working with window forms

//this would add mousewheel event
this.MouseWheel += new MouseEventHandler(CallMeOnMouseWheelUse);

void private CallMeOnMouseWheelUse(object sender, MouseEventArgs e)
{
            if (e.Delta > 0)
                {
                //mouse wheel up
                this.Cursor=Cursors.Cross;//the plus cursor
                }
            else
                {
               // mouse wheel down
               this.Cursor=Cursors.IBeam;
               //windows doesn't have a "-" sign cursor i guess
                }
}


这篇关于鼠标滚动按钮事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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