利Graphics g=this.CreateGraphics()进行绘图,保存时只能保存在paint里画的背景图片,并不能保存自己在处理函数里画的线。
而利用Graphics g=Graphics.FormImage();画图时很慢,而且要不断的刷新才能显示画的线。所以这个基本上不想用。
请问谁能帮想一个利用Graphics g=this.CreateGraphics()画线并能保存自己画线的方法?
而利用Graphics g=Graphics.FormImage();画图时很慢,而且要不断的刷新才能显示画的线。所以这个基本上不想用。
请问谁能帮想一个利用Graphics g=this.CreateGraphics()画线并能保存自己画线的方法?
解决方案 »
- 求关于c#程序集的学习资料
- c# webBrowser 如何判断是否是弹出的对话框?
- C# asp.net中CS和BS的编程语言是否一样??
- 大家帮忙看看这个问题
- 如何把数据库中的视频文件(.wmv格式)读出来?
- 如何在导入注册表文件时,不显示对话框?
- 如何把datagrid1 中的数据复制到datagrid2中?
- 在其它机子上调试时出现"无法在WEB服务器上启动调试,无法将调试启试页URL映射到计算机名"
- 关于用C#的POST。。。高手帮忙。。。
- 如何获得局域网内所有的AD Server 的IP 和域名全称
- 为何捕获不到button控件的mouseup事件?
- //-----------------------------------------------------------------浏览器问题.求高手解决!!
你保存的时候新建一个Bitmap,并且把它的画布传给这个画线的函数。
GraphicsPath mygraphics = new GraphicsPath();
Pen mypen = new Pen(Color.Red, 1); mygraphics.StartFigure();
//为图形路径添加文字
string stringText = this.textBox1.Text;
int style = (int)FontStyle.Italic;
int emSize = 30;//限制字符em(字体大小)方框的高度
//this.panel2.BackgroundImage = mygraphics;
PointF origin = new PointF(0, 0);//设置图形起始位置
StringFormat format = StringFormat.GenericDefault;
mygraphics.AddString(stringText, new FontFamily("Arial"), style, emSize, origin, format);
//SolidBrush mypen = new SolidBrush(Color.Red);
//graphics1.FillPath(mypen, mygraphics);
graphics1.DrawPath(mypen, mygraphics);
graphics1.Save();