C# 中我要截取Bitmap的某一部分 怎么做

ccy222 2009-09-07 06:55:46
TextureBrush MyBrush=new TextureBrush(tmpBmp);
this.picPreview.Refresh();
e.Graphics.TranslateTransform(iRotX,iRotY);
MyBrush.RotateTransform(iAngle);
e.Graphics.TranslateTransform(-iRotX,-iRotY);
e.Graphics.FillRectangle(MyBrush,0,0,this.ClientRectangle.Width,this.ClientRectangle.Height);

我要在此基础上将tmpBmp截取 请问我改怎么做?
...全文
812 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
dylike 2009-09-07
  • 打赏
  • 举报
回复
CopyFromScreen
dylike 2009-09-07
  • 打赏
  • 举报
回复
更简单的是用Graphics.Copyofscreen
wuyq11 2009-09-07
  • 打赏
  • 举报
回复
Bitmap b=(Bitmap)Image.FromFile("");
Bitmap bmp=b.Clone(new System.Drawing.Rectangle(0,0,20,20),System.Drawing.Imaging.PixelFormat.Format32bppPArgb);

Image image = System.Drawing.Image.FromFile("a.jpg",true);
Bitmap bmp = new Bitmap(400,400);
Graphics grap = Graphics.FromImage(bmp);
grap.Clear(Color.Transparent);
grap.DrawImage(image,new Rectangle(0,0,400,400));
TTOJJ 2009-09-07
  • 打赏
  • 举报
回复
到MSDN中查下Graphics.DrawImage()~裏面有好多重載
也可以自己寫函數~~圖片只是一組二維數組,當然還有文件格式,這個都有現成的,簡單的圖形操作樓主應該學會

110,568

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧