[英]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
. 我正在使用
trackBar1
在硬盘上的图像之间移动,并在pictureBox1
显示每个图像。
Now I also can draw points red points on each image in the pictureBox1
. 现在,我还可以在
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
. 我想做的是,如果我在
pictureBox1
显示的当前图像上绘制了一些点,那么我绘制的内容将被保存/保留在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. 我的意思是,如果我绘制了一些东西,那么我将
trackBar1
向前移动一个刻度到下一张图像,这样这些点将不会显示在下一幅图像上,但是如果我将trackBar1
向后移动一次,我将在另一幅图像上看到之前绘制的内容。 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. 我不想将其作为文件保存到硬盘上,而是为了保持视觉效果而将我在
pictureBox1
绘制的图像保持在trackBar1
现在所在的当前位置。
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. 如果我将trackBar1移到另一个图像,则这些点将被删除,如果我后退,请看我在另一个图像上绘制的点。 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.
您必须在图片框的Paint事件处理程序中进行绘制。 Whenever the picture needs to be redrawn, then the Paint event will be raised automatically.
每当需要重绘图片时,Paint事件都会自动引发。 See the example on msdn
请参阅msdn上的示例
I am against PictureBox-es completely, but if you insist: 我完全反对PictureBox-es,但是如果您坚持:
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...
不用担心在硬盘上有双重图像...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.