简体   繁体   中英

DrawLines over Image using graphics in compact framework

I have a picturebox control in which by using mouse down and mouse move events ,I am drawing a image using points and storing it in my database. and in update mode I am retrieving the bytes and drawing an image in to the picture box control and now I am adding few lines more on the image but either I am getting newly added lines or the old image but i want both

  //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 is my byte array of my image

         gxComp.DrawLines(pen, _currentStroke.ToArray());

_currentStroke is the list of points.

Creating the grahics of image and drawing lines on to that graphics object has solved my problem.

          //Ref with above Code

//Creating the graphics of the image if exists

      gxcomp=Graphics.FromImage(im);

and //writing my new drawn points on to the graphics

       gxComp.DrawLines(pen, _currentStroke.ToArray());

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM