.NET触发MouseWheel事件
来源:互联网 发布:图册排版设计软件 编辑:程序博客网 时间:2024/04/28 19:09
该方法适用于ListBox,Panel等,可惜ListView小弟我没有try成功。
private int fontSize = 6;
private void Form1_Load(object sender, EventArgs e)
{
listBox1.MouseWheel += new MouseEventHandler(this.listBox1_MouseWheel);
listBox1.SelectedIndex = 10;
}
private void listBox1_MouseWheel(object sender, System.Windows.Forms.MouseEventArgs e)
{
int numberOfTextLinesToMove = e.Delta * SystemInformation.MouseWheelScrollLines / 120;
int numberOfPixelsToMove = numberOfTextLinesToMove * fontSize;
GraphicsPath mousePath = new GraphicsPath();
if (numberOfPixelsToMove != 0)
{
System.Drawing.Drawing2D.Matrix translateMatrix = new System.Drawing.Drawing2D.Matrix();
translateMatrix.Translate(0, numberOfPixelsToMove);
mousePath.Transform(translateMatrix);
}
listBox1.Invalidate();
}
private void Form1_Load(object sender, EventArgs e)
{
listBox1.MouseWheel += new MouseEventHandler(this.listBox1_MouseWheel);
listBox1.SelectedIndex = 10;
}
private void listBox1_MouseWheel(object sender, System.Windows.Forms.MouseEventArgs e)
{
int numberOfTextLinesToMove = e.Delta * SystemInformation.MouseWheelScrollLines / 120;
int numberOfPixelsToMove = numberOfTextLinesToMove * fontSize;
GraphicsPath mousePath = new GraphicsPath();
if (numberOfPixelsToMove != 0)
{
System.Drawing.Drawing2D.Matrix translateMatrix = new System.Drawing.Drawing2D.Matrix();
translateMatrix.Translate(0, numberOfPixelsToMove);
mousePath.Transform(translateMatrix);
}
listBox1.Invalidate();
}
- .NET触发MouseWheel事件
- C# 中panel的mousewheel事件触发
- C# panel的mousewheel事件触发
- C# 中panel的mousewheel事件触发 (转)
- C# 中panel的mousewheel鼠标滚轮事件触发
- Winform 中panel的mousewheel鼠标滚轮事件触发
- C# 中panel的mousewheel鼠标滚轮事件触发
- Mousewheel 事件
- 浅谈 Mousewheel 事件
- 鼠标滑轮MouseWheel事件
- 浅谈 Mousewheel 事件
- 鼠标-滚动-Mousewheel-事件
- 浅谈 Mousewheel 事件
- winform MouseWheel事件无效
- ASP.net 事件触发顺序
- ASP.NET 事件触发顺序
- js触发.net服务器端事件
- .NET RadioButton 触发双击事件
- vb6中的hook技术
- 简单得创建JAVASCRIPTE WEB丰富界面以及与JAVA服务互相访问
- 好久不见了,丁丁
- 捕获浏览器关闭事件
- how to express technical issues
- .NET触发MouseWheel事件
- asp收集函数(一)
- 感恩节
- 当状元必须被阉割 历史上最惨的大官
- 四﹑博客周刊•推荐Blog专家
- 简单的计数器
- Code Tracing
- .NET ListView选中行的定位显示
- gcc与g++有什么区别?