c# 鼠标控制图片大小
2013-05-15 15:25
330 查看
首先在窗体构造方法,里加入这样一句话
C#代码
this.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseWheel);
C#代码
#region 进入窗体时加载
public FormAlarmInfoQuery()
{
InitializeComponent();
pictureBox1.ImageLocation = "f:\\1.jpg";
this.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseWheel);
//判断是否已安装带滚轮的鼠标
//SystemInformation.MouseWheelPresent.ToString();
//获取鼠标滚轮在滚动时所获得的行数
//SystemInformation.MouseWheelScrollLines.ToString();
//判断该操作系统是否支持滚轮鼠标
//SystemInformation.NativeMouseWheelSupport.ToString();
}
#endregion
然后写一个鼠标事件方法
C#代码
private void panel1_MouseWheel(object sender, System.Windows.Forms.MouseEventArgs e)
{
MessageBox.Show("滚动事件已被捕捉");
System.Drawing.Size t = pictureBox1.Size;
t.Width += e.Delta;
t.Height += e.Delta;
pictureBox1.Width = t.Width;
pictureBox1.Height = t.Height;
}
如果输出了“滚动事件已被捕捉”,那么鼠标滚轮事件就成功被捕捉了,就可以在在里边写让鼠标滚轮处理的事件了
黑色头发:http://heisetoufa.iteye.com
C#代码
this.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseWheel);
C#代码
#region 进入窗体时加载
public FormAlarmInfoQuery()
{
InitializeComponent();
pictureBox1.ImageLocation = "f:\\1.jpg";
this.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseWheel);
//判断是否已安装带滚轮的鼠标
//SystemInformation.MouseWheelPresent.ToString();
//获取鼠标滚轮在滚动时所获得的行数
//SystemInformation.MouseWheelScrollLines.ToString();
//判断该操作系统是否支持滚轮鼠标
//SystemInformation.NativeMouseWheelSupport.ToString();
}
#endregion
然后写一个鼠标事件方法
C#代码
private void panel1_MouseWheel(object sender, System.Windows.Forms.MouseEventArgs e)
{
MessageBox.Show("滚动事件已被捕捉");
System.Drawing.Size t = pictureBox1.Size;
t.Width += e.Delta;
t.Height += e.Delta;
pictureBox1.Width = t.Width;
pictureBox1.Height = t.Height;
}
如果输出了“滚动事件已被捕捉”,那么鼠标滚轮事件就成功被捕捉了,就可以在在里边写让鼠标滚轮处理的事件了
黑色头发:http://heisetoufa.iteye.com
相关文章推荐
- C#winform用鼠标滚轮控制图片大小,MouseWheel事件
- [转]c# winform 用鼠标滚轮控制图片大小,获取鼠标中键滚轮事件,MouseWheel事件
- 自由控制显示图片大小,鼠标拖动图片看效果
- 鼠标滚轮控制图片大小
- c# winform 用鼠标滚轮控制图片大小,获取鼠标中键滚轮事件,MouseWheel事件
- 用鼠标滑轮控制图片大小js
- 鼠标控制图片大小
- 学习笔记 鼠标滚轮控制图片大小
- 鼠标滚轮控制图片大小
- 鼠标滚轮控制图片大小
- C#控制生成图片的大小
- 鼠标滚轮控制图片大小,获取滚轮事件
- 通过鼠标滑轮控制图片大小
- C#图像处理(各种旋转、改变大小、柔化、锐化、雾化、底片、浮雕、黑白、滤镜效果,滤波,图像截取) 对图片的处理 : 亮度调整 抓屏 翻转 随鼠标画矩形
- 鼠标滚轮控制图片大小。
- 用鼠标滑轮控制图片大小的显示
- 鼠标滚轮控制图片大小
- JS 图片缩放、显示全图、鼠标滑轮控制显示大小
- 页面图片鼠标滑轮拖动大小,加载控制大小
- [网页]鼠标滚轮控制图片大小