zoukankan      html  css  js  c++  java
  • 图形技术(局部图片放大)

    界面:

    核心代码: 

    Cursor myCursor = new Cursor(@"C:\WINDOWS\Cursors\aero_cross.cur"); //自定义鼠标 
      Image myImage;

    //选择图片

     private void button1_Click(object sender, EventArgs e)
            {
                openFileDialog1.Filter = "*.jpg,*.jpeg,*.bmp,*.gif,*.ico,*.png,*.tif,*.wmf|*.jpg;*.jpeg;*.bmp;*.gif;*.ico;*.png;*.tif;*.wmf";
                openFileDialog1.ShowDialog();
                myImage = System.Drawing.Image.FromFile(openFileDialog1.FileName);
                pictureBox1.Image = myImage;
                pictureBox1.Height = myImage.Height;
                pictureBox1.Width = myImage.Width;
            }

    //鼠标经过的地方放大

            private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
            {
                try
                {
                    Cursor.Current = myCursor;
                    Graphics graphics = pictureBox1.CreateGraphics();
                    Rectangle sourceRectangle = new Rectangle(e.X - 10, e.Y - 10, 20, 20); //要放大的区域
                    Rectangle destRectangle = new Rectangle(e.X - 20, e.Y - 20, 40, 40);
                    graphics.DrawImage(myImage, destRectangle, sourceRectangle, GraphicsUnit.Pixel);
                }
                catch
                { }
            }

  • 相关阅读:
    gym101350 c h m
    Gym
    poj 1511 Invitation Cards(最短路中等题)
    POJ 1062 昂贵的聘礼(最短路中等题)
    POJ 1125 Stockbroker Grapevine(最短路基础题)
    【Linux】buffer cache free 理解
    python 绘图 工具
    【Linux】时间跟时区的校正
    python conda、pip区别,python 下 faiss 安装
    celery-demo
  • 原文地址:https://www.cnblogs.com/msAspnet/p/2098984.html
Copyright © 2011-2022 走看看