I had already thought, but I do not know how. Basically I have 2 routines, one that I copy in memory the initial image that is in PaintBox1, and the other charging me a video:
Code:
Private Sub SaveImageTEMP()
TempBMP = New Drawing.Bitmap(PictureBox1.Width, PictureBox1.Height)
PictureBox1.DrawToBitmap(TempBMP, New Rectangle(0, 0, TempBMP.Width, TempBMP.Height))
Exit Sub
Private Sub PasteImageTEMP()
Dim bm As Bitmap = TempBMP
Dim bm_dest As New Bitmap(bm.Width, bm.Height)
Dim gr_dest As Graphics = Graphics.FromImage(bm_dest)
gr_dest.DrawImage(bm, 0, 0, bm_dest.Width + 1, bm_dest.Height + 1)
g = Graphics.FromImage(bm)
PictureBox1.Image = bm
Exit Sub
Then in the events related to Paintbox:
MouseDown:
SaveImageTEMP-here I call the procedure and stores the coordinates of the point of departure
Mousemove:
-do from the PasteImageTEMP to fetch initial image, then stores the point where I am and launch a DrawRectangle
MouseUp
-name still PasteImageTEMP and then draw the rectangle final.
But still can not see anything while dragging the mouse, but when I release it draws the rectangle you want, plus a series of rectangles "intermediate" I would have used before ...
Bookmarks