码迷,mamicode.com
首页 > 其他好文 > 详细

局部图像放大

时间:2019-01-13 00:24:10      阅读:237      评论:0      收藏:0      [点我收藏+]

标签:src   move   csu   知识   指定位置   csharp   pix   new   highlight   

实现效果:

  技术分享图片

知识运用:

  DrawImage方法

  public void DrawImage (Image image, Point point)    //指定位置绘制原始大小图像

  publIc void DrawImage (Image image,Rectangel rect)    //指定位置绘制指定大小的Image图像

  publicvoid DrawImage (Image image, Point[] destPoints, Rectangle srcRect, GraphicsUnit srcUnit)  //指定大小绘制指定部分的图像

  # image      要绘制的Image图像

  # destImage    有三个Point结构组成的数组 这三个结构定义一个平行四边形

  # srcRect      Rectangle结构 指定image中要绘制的部分

  # srcUnit          GraphicsUnit枚举成员  指定srcRect参数所用的度量单位

实现代码:

        private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
        {
            try
            {
                Cursor.Current = myCursor;                                          //定义鼠标  
                Rectangle rectangle = new Rectangle(e.X-10,e.Y-10,20,20);           //要放大的区域
                Rectangle destRectangle = new Rectangle(e.X-40,e.Y-40,80,80);
                Graphics graphics = pictureBox1.CreateGraphics();                   //创建pictureBox1控件的Graphics对象
                graphics.DrawImage(image,destRectangle,rectangle,GraphicsUnit.Pixel);
            }
            catch{}
        }

  

局部图像放大

标签:src   move   csu   知识   指定位置   csharp   pix   new   highlight   

原文地址:https://www.cnblogs.com/feiyucha/p/10261259.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!