How to kept a graphic drawing in a picturebox on a tab control after switching to tab 2 and return to tab 1?

前端 未结 1 1864
醉酒成梦
醉酒成梦 2021-01-27 01:03

I have a Tab Control with two (2) Tabs. The Tab 1 does a drawing in a picture box (the picture box is optional, I can draw directly to the tab) using Graphics Addline. The seco

相关标签:
1条回答
  • 2021-01-27 01:40

    Its done, I just used a Bitmap to draw to it and the set the picturebox image with the bitmap.

    The code I used is as follows:

    Bitmap image = new Bitmap(pictureBox1.Width, pictureBox1.Height);
    Graphics g = Graphics.FromImage(image);
    
    // In between all the code required for extracting the data and do the draw.
    
    pictureBox1.Image = image;
    

    Thanks anyway to whoever saw my question and try to answer it.

    0 讨论(0)
提交回复
热议问题