图片放大镜(悬浮在原图上)

时间:2016-09-23 11:33:00
【文件属性】:
文件名称:图片放大镜(悬浮在原图上)
文件大小:46KB
文件格式:ZIP
更新时间:2016-09-23 11:33:00
双缓冲画图 控件的paint C# 点击加载图片后,按下鼠标左键并移动鼠标,图片上会悬浮一个显示原图大小的放大区域。就是一个图片放大镜。使用双缓冲技术,解决图片闪烁问题!! 关键代码: picImage.Paint +=new PaintEventHandler(picImage_Paint); protected void picImage_Paint(object sender, PaintEventArgs e ) { if (NotFirstLoad ==true ) { Bitmap bit = new Bitmap(ZoomIn_Width, ZoomIn_Height); Graphics g = Graphics.FromImage(bit); g.SmoothingMode = SmoothingMode.AntiAlias; g.DrawImage(picImage.Image, new Rectangle(0, 0, ZoomIn_Width, ZoomIn_Height), new Rectangle(Convert.ToInt16(ex * Rate - ZoomIn_Width / 2), Convert.ToInt16(ey * Rate - ZoomIn_Height / 2), ZoomIn_Width, ZoomIn_Height), GraphicsUnit.Pixel); e.Graphics.DrawImage(bit, ZoomIn_X , ZoomIn_Y, ZoomIn_Width, ZoomIn_Height); //Graphics g2 = this.picImage.CreateGraphics(); //g2.DrawImage(bit, ZoomIn_X, ZoomIn_Y, ZoomIn_Width, ZoomIn_Height); //g.Dispose(); }
【文件预览】:
doublebuffer
----doublebuffer.sln(926B)
----doublebuffer()
--------frmViewPicture.Designer.cs(3KB)
--------bin()
--------Program.cs(502B)
--------frmViewPicture.resx(6KB)
--------obj()
--------doublebuffer.csproj(4KB)
--------frmViewPicture.cs(7KB)
--------Properties()
----doublebuffer.suo(17KB)

网友评论