简体   繁体   English

移动trackBar1时,如何保持在图片盒1中的图像上绘制的点?

[英]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,但是如果您坚持:

  • 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. 我在图片上绘制了一些东西,将另一张图片保存在磁盘上,给它起一个像这样的名称:original-OVR.png。 I mean, suffix the name with -OVR. 我的意思是,在名称后加上-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... 不用担心在硬盘上有双重图像...

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在将鼠标移到pictureBox1上时自动在pictureBox2上绘制点? - How can i make that when i move the mouse ober pictureBox1 it will draw points automatic on pictureBox2? 如何将pictureBox1中的图像替换为pictureBox1矩形区域上绘制的裁剪图像? - How can i replace the image in pictureBox1 with a crop image of a drawn on the pictureBox1 rectangle area? 如何将图片从PictureBox1复制到Excel? - How to copy image from PictureBox1 to excel? 我正在尝试将pictureBox1内的图像保存到我的硬盘上,但是将其保存而没有pictureBox1内的矩形,这是为什么呢? - Im trying to save now the image inside the pictureBox1 to my hard disk but its saving it without the rectangle inside the pictureBox1 why? 如何使计时器向前或向后更改pictureBox1中显示的图像? - How can I make timer that will change the images display in pictureBox1 forward or backward? 如果用户处于鼠标按下事件中,如何检查pictureBox1鼠标离开事件? - How can i check on pictureBox1 mouse leave event if the user is in mouse down event? 如何根据我将trackBar1值移动到的位置获取正确的文件名编号? - How do i get the correct file name number according to where i moved the trackBar1 value? 图片从picturebox1到picturebox2 - image from picturebox1 to picturebox2 我无法从 C# 中的代码更改 pictureBox1 中的图像 - I cannot change the image in pictureBox1 from code in C# 如何使用factor变量使位图适合pictureBox1? - How can I use the factor variable to make the bitmap to fit in the pictureBox1?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM