zoukankan      html  css  js  c++  java
  • 局部图像放大

    实现效果:

      

    知识运用:

      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{}
            }
    

      

  • 相关阅读:
    hdu 1124 OR toj 1065 简单数论
    this和判断的位置对赋值的要求
    快捷键操作
    常量池和堆的区别
    toString的用法
    使用泛型解决之前的问题
    不使用泛型会运行时会出现的问题
    集合图型
    代码块运行的优先级
    遍历集合的Iterator删除其中的元素
  • 原文地址:https://www.cnblogs.com/feiyucha/p/10261259.html
Copyright © 2011-2022 走看看