请问:C# 中怎么把画在pictureBox控件上的图和文字一并存入文件中。
画图代码如下:
private void pictureBox2_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
Graphics g=e.Graphics;
Image image=new Bitmap(@"C:\pad for one pitch_1.bmp");
g.DrawImage(myBitmap,0,0,pictureBox2.Width,pictureBox2.Height);
RectangleF rect=new RectangleF(0,180,376,90);
g.DrawString("Wait for your solution,thanks!",new Font("Microsoft Sans Serif", 12),new SolidBrush(Color.Green),rect);
}问题:怎么把控件上的Graphics内容存入文件中。
我试着把抽象类graphics对象转换成bitmap不成功在线等待大人的解答,不甚感激!!!!
画图代码如下:
private void pictureBox2_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
Graphics g=e.Graphics;
Image image=new Bitmap(@"C:\pad for one pitch_1.bmp");
g.DrawImage(myBitmap,0,0,pictureBox2.Width,pictureBox2.Height);
RectangleF rect=new RectangleF(0,180,376,90);
g.DrawString("Wait for your solution,thanks!",new Font("Microsoft Sans Serif", 12),new SolidBrush(Color.Green),rect);
}问题:怎么把控件上的Graphics内容存入文件中。
我试着把抽象类graphics对象转换成bitmap不成功在线等待大人的解答,不甚感激!!!!
解决方案 »
- SQLite数据库加密问题,加密后,就打不开了
- 打印指定的 DIV
- 为什么datagridview显示数据非常慢?????
- C#控件读取数据库的问题
- 一个SQL语句,困扰了我一下午,求解答
- C# 创建个文件夹 再在里面写个文件 新人照顾下
- Web 应用程序没办法调试!:-'( 急,高分相送!
- 怎么将Office组件加到C#中进行开发(100分)
- 混装VSNET2002和2003后出了问题,帮忙解决
- 在C#中获取了系统所有的IP,如何知道那个IP是和那个网卡匹配的呢?
- 在C#中怎样才能把子窗体拖出父窗体的界面
- 在做一个WINFORM项目时,DataGrid控件绑定DataTable,如何去除最后那个NULL行?(急)
System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(this.Width,this.Height);
this.DrawToBitmap(bitmap, this.ClientRectangle);
bitmap.Save(fileName);
Image.Save(fileName);只是把图片存起来了
不过我现在不仅要存iamge,上面的文字也要存起来,也就是graphics内容
private void pictureBox1_Paint(object sender, PaintEventArgs e)
{
e.Graphics.DrawString("aaaa", this.pictureBox1.Font, SystemBrushes.ControlText, 0, 0);
}private void pictureBox1_DoubleClick(object sender, EventArgs e)
{
Bitmap bit = new Bitmap(this.pictureBox1.Width, this.pictureBox1.Height);
this.pictureBox1.DrawToBitmap(bit, this.pictureBox1.ClientRectangle);
bit.Save("D:\\a.bmp");
}
可能因为我用的是.net2003
你用的是什么版本的?
要是可以把graphics对象转换成bitmap就好了...
不过你可以把你在画图的时候用到的Image来保存.可以把这个做成全局变量.
没啥可说的
多谢hbxtlhx(平民百姓)