绘制矩形和椭圆,然后保存为jpg [英] Drawing rectangles and ellipses then saving in jpg

查看:111
本文介绍了绘制矩形和椭圆,然后保存为jpg的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨 我正在寻找可下载的源代码.
它必须像:
http://www.codeproject.com/KB/graphics/drawtools.aspx?msg=3668999
效果很好,但可惜该项目无法将结果保存为JPG或GIF格式...

我希望用户使用矩形和椭圆形创建纯图像并将其保存为fromat的jpg.

亲切的问候
Heinrich

Hi I am looking for download able source code.
It must be like:
http://www.codeproject.com/KB/graphics/drawtools.aspx?msg=3668999
That is working perfectly but sadly this project can''t save result in JPG or GIF format...

I want a user to create an plain image using rectangles and ellipses and save it in jpg fromat.

Kind regards
Heinrich

推荐答案

您可以从发布的链接中使用项目,然后使用

You could use the project from the link you posted and then use the

drawArea.DrawToBitmap()



创建位图的方法.然后可以将此位图另存为* .bmp,*.jpg ...

好,

这是一个示例:



method to create a bitmap. This bitmap can then be saved as*.bmp, *.jpg...

Ok,

here is an example:

private void toolStripButtonSave_Click(object sender, EventArgs e)
{
  int w = drawArea.Width;
  int h = drawArea.Height;
  Bitmap bmp = new Bitmap(w, h);
  drawArea.DrawToBitmap(bmp, Rectangle.FromLTRB(0, 0, w, h));
  bmp.Save("C:\\Temp\\test.jpg");
  CommandSave();
}



如您所见,我修改了保存"工具栏按钮的事件处理程序.我已经对其进行了测试,并且效果很好!



As you can see I modified the event handler for the "Save" toolbar button. I have tested it and it works fine!


感谢您的回复
我将如何使用"drawArea.DrawToBitmap()"
放在哪里?

亲切的问候
Thanks for the reply
how would i use the "drawArea.DrawToBitmap()"
where would it put it in?

kind regards


这篇关于绘制矩形和椭圆,然后保存为jpg的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆