C# GDI+ 如何根据画的椭圆,截取椭圆里的内容保存为图片? C# GDI+ 如何根据画的椭圆,不是矩形,截取椭圆里的内容保存为图片?GDI+图片C# 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你说下吧,只要不要用到系统API调用就好了~—-— Image img = new Bitmap(500, 400);Graphics g = Graphics.FromImage(img);g.FillEllipse(Brushes.SkyBlue, 50, 50, 400, 300);g.Save();g.Dispose();img.Save("d:\\abc.png"); Image img = new Bitmap(500, 400);Graphics g = Graphics.FromImage(img);Brush brush = new TextureBrush(bgImage);//bgImage是你的背景图片g.FillEllipse(brush, 50, 50, 400, 300);g.Save();g.Dispose();brush.Dispose();img.Save("d:\\abc.png"); 那如果你由GraphicsPath组成的一个圆呢?因为是画笔在上面随便画的,如果画出的是一个圆就获取这部分 Image img = new Bitmap(500, 400);Graphics g = Graphics.FromImage(img);Brush brush = new TextureBrush(bgImage);//bgImage是你的背景图片g.FillPath(brush, path); //path 是你的GraphicsPathg.Save();g.Dispose();brush.Dispose();img.Save("d:\\abc.png"); Bitmap bp = new Bitmap((int)rf.Width,(int)rf.Height); Graphics gs = Graphics.FromImage(bp); Brush bs = new TextureBrush(this.pb_touch.BackgroundImage); _clearRoundPath = ScaleTranform(pointfs, _clearPenSize); gs.FillPath(bs,_clearRoundPath); bp.Save(Initialize.Const.Screenpath+"\\aa.jpg");这样保存的图片什么都没有。。 _clearRoundPath = ScaleTranform(pointfs, _clearPenSize);这里的_clearRoundPath的区域会不会是Empty, 或者不包括this.pb_touch.BackgroundImage的任何部分!还有一点,最好在 bp.Save(Initialize.Const.Screenpath+"\\aa.jpg");前面加上 gs.Save(); private void pb_touch_Paint(object sender, PaintEventArgs e) { Graphics g = e.Graphics; if (_clearRoundPath != null) { Bitmap bp = new Bitmap((int)rf.Width,(int)rf.Height); Graphics gs = Graphics.FromImage(bp); Brush bs = new TextureBrush(this.pb_touch.BackgroundImage); g.DrawPath(new Pen(Brushes.Blue), _clearRoundPath); //这里都能画出_clearRoundPath来 gs.FillPath(bs,_clearRoundPath); gs.Save(); bp.Save(Initialize.Const.Screenpath+"\\aa.jpg"); //这里有保存一张图片,但图片内容什么都没有 } }”或者不包括this.pb_touch.BackgroundImage的任何部分!“这句话是什么意思?我就是在pb_touch这个控件上画的啊 提取html文本正则表达式问题 求一个正则表达式 Winform 里面选取点 连线 关于调试程序弹出dos界面的问题 路径转换问题 代码运行一个程序的问题 vsto EXCEL程序不退出 为什么不能在运行一个eXCEL VS2003 Form 小问题!!!! 做了一个软件给客户,如何实现sn功能 使用mygeneration时设置oracle连接串遇到小问题 这里的高手是不是不屑回答简单的阿,我问的问题都没啥反映的?再问个thread的问题:( IndexOutOfRangeException 错误 WPF,数据绑定为什么没反应
Image img = new Bitmap(500, 400);
Graphics g = Graphics.FromImage(img);
g.FillEllipse(Brushes.SkyBlue, 50, 50, 400, 300);
g.Save();
g.Dispose();
img.Save("d:\\abc.png");
Image img = new Bitmap(500, 400);
Graphics g = Graphics.FromImage(img);
Brush brush = new TextureBrush(bgImage);//bgImage是你的背景图片
g.FillEllipse(brush, 50, 50, 400, 300);
g.Save();
g.Dispose();
brush.Dispose();
img.Save("d:\\abc.png");
那如果你由GraphicsPath组成的一个圆呢?因为是画笔在上面随便画的,如果画出的是一个圆就获取这部分
Image img = new Bitmap(500, 400);
Graphics g = Graphics.FromImage(img);
Brush brush = new TextureBrush(bgImage);//bgImage是你的背景图片
g.FillPath(brush, path); //path 是你的GraphicsPath
g.Save();
g.Dispose();
brush.Dispose();
img.Save("d:\\abc.png");
Bitmap bp = new Bitmap((int)rf.Width,(int)rf.Height);
Graphics gs = Graphics.FromImage(bp);
Brush bs = new TextureBrush(this.pb_touch.BackgroundImage);
_clearRoundPath = ScaleTranform(pointfs, _clearPenSize);
gs.FillPath(bs,_clearRoundPath);
bp.Save(Initialize.Const.Screenpath+"\\aa.jpg");
这样保存的图片什么都没有。。
_clearRoundPath = ScaleTranform(pointfs, _clearPenSize);这里的_clearRoundPath的区域会不会是Empty, 或者不包括this.pb_touch.BackgroundImage的任何部分!还有一点,最好在
bp.Save(Initialize.Const.Screenpath+"\\aa.jpg");
前面加上
gs.Save();
private void pb_touch_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
if (_clearRoundPath != null)
{ Bitmap bp = new Bitmap((int)rf.Width,(int)rf.Height);
Graphics gs = Graphics.FromImage(bp);
Brush bs = new TextureBrush(this.pb_touch.BackgroundImage);
g.DrawPath(new Pen(Brushes.Blue), _clearRoundPath); //这里都能画出_clearRoundPath来
gs.FillPath(bs,_clearRoundPath);
gs.Save();
bp.Save(Initialize.Const.Screenpath+"\\aa.jpg"); //这里有保存一张图片,但图片内容什么都没有
}
}
”或者不包括this.pb_touch.BackgroundImage的任何部分!“这句话是什么意思?我就是在pb_touch这个控件上画的啊