Bitmap _NewBitmap =new Bitmap(src_rectangle.Width,src_rectangle.Height);
            pictureBox1.Image = pictureBox1.DrawToBitmap(_NewBitmap, src_rectangle);

解决方案 »

  1.   

    当初写的抓取摄像头图片后截图的代码
    截图后放panel上,panel上选择后双击事件,picturebox估计一样的private void panelSelect_DoubleClick(object sender, EventArgs e)
            {
                Screen scr = Screen.PrimaryScreen;
                Rectangle rc = scr.Bounds;
                int iWidth = rc.Width;
                int iHeight = rc.Height;
                //创建一个和屏幕一样大的Bitmap            Image myImage = new Bitmap(this.panelSelect.Width-2, this.panelSelect.Height-2);
                //从一个继承自Image类的对象中创建Graphics对象            Graphics g = Graphics.FromImage(myImage);
                //抓屏并拷贝到myimage里            g.CopyFromScreen(this.panelSource.PointToScreen(new Point(this.panelSelect.Location.X+1,this.panelSelect.Location.Y+1)), new Point(0, 0),new Size(this.panelSelect.Width-2,this.panelSelect.Height-2));
                //保存为文件
                //this.image = myImage;
                Console.WriteLine("after capture width:"+myImage.Width+",height:"+myImage.Height);
                this.pic.Image = myImage;
                //this.pictureBox1.Image = this.image;
                //this.Close();
               // this.pictureBox2.Image = myImage;
            }
      

  2.   

    这个方法,我试过了不行。
    问题出在Bitmap _NewBitmap =new Bitmap(src_rectangle.Width,src_rectangle.Height);这里面用到的src_rectangle仅仅是把一个空的矩形存进来了,而不是pictureBox上的一部分图片,请问这个该怎么弄呢?