如何提取picturebox上的一部分图片 Bitmap _NewBitmap =new Bitmap(src_rectangle.Width,src_rectangle.Height); pictureBox1.Image = pictureBox1.DrawToBitmap(_NewBitmap, src_rectangle); 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 当初写的抓取摄像头图片后截图的代码截图后放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; } 这个方法,我试过了不行。问题出在Bitmap _NewBitmap =new Bitmap(src_rectangle.Width,src_rectangle.Height);这里面用到的src_rectangle仅仅是把一个空的矩形存进来了,而不是pictureBox上的一部分图片,请问这个该怎么弄呢? 请问在编程里面什么叫句柄,什么叫手柄??? C#调用Oracle里的函数,返回一个结果集。。求代码 http通讯客户端是使用HttpWebRequest还是socket 讨论C#软件模块升级 panel 滚动条的问题 报表制作的问题 如何点击按钮停止线程 关于打包安装求助 一个需要自动遍历子类的问题 大家推荐一下学习C#的书! 用C#根据用户名和密码获取我邮箱里面的好友 哪位高手有c#的一维排料代码呀?请赐小弟一份!
截图后放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;
}
问题出在Bitmap _NewBitmap =new Bitmap(src_rectangle.Width,src_rectangle.Height);这里面用到的src_rectangle仅仅是把一个空的矩形存进来了,而不是pictureBox上的一部分图片,请问这个该怎么弄呢?