C# DrawToBitmap截取from图的问题,! 我也遇到这个问题了,不知道你是怎么解决的?麻烦了
展开全部
Bitmap sourceBitmap = new Bitmap(this.Width, this.Height);
this.DrawToBitmap(sourceBitmap, new Rectangle(0, 0, this.Width, this.Height));
sourceBitmap.Save(@"d:\form2.bmp");
Bitmap resultBitmap = new Bitmap(this.Width, this.ClientSize.Height);
Graphics gr = Graphics.FromImage(resultBitmap);
Rectangle sourceRectangle = new Rectangle(0, this.Height - this.ClientSize.Height, this.Width, this.ClientSize.Height);
Rectangle resultRectangle = new Rectangle(0, 0, this.Width, this.ClientSize.Height);
gr.DrawImage(sourceBitmap, resultRectangle, sourceRectangle, GraphicsUnit.Pixel);//截取图片中的一部分
resultBitmap.Save(@"d:\form.bmp");
this.DrawToBitmap(sourceBitmap, new Rectangle(0, 0, this.Width, this.Height));
sourceBitmap.Save(@"d:\form2.bmp");
Bitmap resultBitmap = new Bitmap(this.Width, this.ClientSize.Height);
Graphics gr = Graphics.FromImage(resultBitmap);
Rectangle sourceRectangle = new Rectangle(0, this.Height - this.ClientSize.Height, this.Width, this.ClientSize.Height);
Rectangle resultRectangle = new Rectangle(0, 0, this.Width, this.ClientSize.Height);
gr.DrawImage(sourceBitmap, resultRectangle, sourceRectangle, GraphicsUnit.Pixel);//截取图片中的一部分
resultBitmap.Save(@"d:\form.bmp");
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询