简体   繁体   中英

How can i keep the points im drawing on the image in the picturebox1 when moving the trackBar1?

I am using a trackBar1 to move between images I have on the hard disk and I display each image in pictureBox1 .

Now I also can draw points red points on each image in the pictureBox1 .

What I want to do is that if I drew some points on the current image that is show in the pictureBox1 so what I drew will be saved/keep on the current displayed image in the pictureBox1 .

I mean that if I drew something then I move the trackBar1 forward one tick to the next image so the points will not be show on the next image but if I move the trackBar1 backward once I will see on the other image what I drew before. I don't want to save it to the hard disk as file but to visualy to keep what I'm drawing in the pictureBox1 on the current position where the trackBar1 is now.

And if i move the trackBar1 to another image so the points will be deleted and if i move back ill see the points i drawed on the other image. And so on. Where ever i drawed something to keep it so if i move back ill see what i drawed.

Now in my program i can save each image to the hard disk painted or not painted. So i could also load from the hard disk this images i saved. But i want to do it in real time without loading the images from hard disk. Maybe somehow to save it to memory ?

您可以在透明图像中绘制点,该图像覆盖下面的图像,以便在滚动背景图像时保持覆盖。

This is because what you draw on the picture box is not stored in the picture. It is only displayed on the screen. You must do the drawing in Paint event handler of the picture box. Whenever the picture needs to be redrawn, then the Paint event will be raised automatically. See the example on msdn

I am against PictureBox-es completely, but if you insist:

  • load picture into picturebox when appropriate
  • i something is drawn on the picture, save another picture on the DISK, give it a name that would be like: original-OVR.png. I mean, suffix the name with -OVR.

There are more ways to do it, but I guess that you'll be able to get on with this method. Don't worry about having double images on hard drive...

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