您的位置:首页 > 其它

.net 下操作鼠标滚轮的事件 以及换算方法

2009-08-04 17:56 405 查看
Code

public partial class Form1 : Form

{

Bitmap memBitmap;

float currRotation = 10;

Rectangle rect = new Rectangle(100, 50, 150, 100);

public Form1()

{

InitializeComponent();

memBitmap = new Bitmap(this.Width, this.Height);

using (Graphics g = Graphics.FromImage(memBitmap))

{

g.DrawRectangle(Pens.Blue, rect);

}

}

protected override void OnMouseWheel(MouseEventArgs e)

{

currRotation -= 5.0f * e.Delta / SystemInformation.MouseWheelScrollDelta; // 5 degree, you can make it 45

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: