C# 在紧凑框架中使用图形绘制图像上的线条
我有一个picturebox控件,通过使用鼠标按下和鼠标移动事件,我使用点绘制图像并将其存储在数据库中。 在更新模式下,我检索字节并在图片框控件中绘制图像,现在我在图像上再添加几行,但要么是新添加的行,要么是旧图像,但我想要两者C# 在紧凑框架中使用图形绘制图像上的线条,c#,image,graphics,compact-framework2.0,C#,Image,Graphics,Compact Framework2.0,我有一个picturebox控件,通过使用鼠标按下和鼠标移动事件,我使用点绘制图像并将其存储在数据库中。 在更新模式下,我检索字节并在图片框控件中绘制图像,现在我在图像上再添加几行,但要么是新添加的行,要么是旧图像,但我想要两者 //rect is my picture box Bitmap bmp = new Bitmap(rect.Width, rect.Height); // Create compatible graphics
//rect is my picture box
Bitmap bmp = new Bitmap(rect.Width, rect.Height);
// Create compatible graphics
Graphics gxComp = Graphics.FromImage(bmp);
//If i have a image
System.IO.MemoryStream memStream = new System.IO.MemoryStream(TmpSign);
Bitmap im = new Bitmap(memStream);
Tmp是图像的字节数组
gxComp.DrawLines(pen, _currentStroke.ToArray());
_currentStroke是点列表。创建图像图形并在该图形对象上绘制线解决了我的问题
//Ref with above Code
//创建图像的图形(如果存在)
gxcomp=Graphics.FromImage(im);
及
//将新绘制的点写入图形
gxComp.DrawLines(pen, _currentStroke.ToArray());