image editor help
Anything not covered in the other sections like Computer trouble - Hardware Issues - Upgrades and other technical stuff to be asked in here please.
4 posts
Page 1 of 1
hi, i am working on an image editor, like MSPaint. whenever i minimize the screen and re-open it, the drawn image completely vanishes. is there any way to prevent this? thanks!
P.S.
the program was made in vb 2008
-and-
I have uploaded the source!
vvvvvvvvvvvvvvvvvvvvvvvvvvv
P.S.
the program was made in vb 2008
-and-
I have uploaded the source!
vvvvvvvvvvvvvvvvvvvvvvvvvvv
You do not have the required permissions to view the files attached to this post.
Its because you aren't actually drawing to the image in the picturebox, just on the picturebox itself.
With any control on a form if you draw over it and then it refreshes later, your changes will be lost (unless you recreate them after the refresh has occured).
You might be looking to make a graphics object from an image that you load into the picturebox, then you can draw using that and refresh your picturebox and your drawing will be preserved.
With any control on a form if you draw over it and then it refreshes later, your changes will be lost (unless you recreate them after the refresh has occured).
You might be looking to make a graphics object from an image that you load into the picturebox, then you can draw using that and refresh your picturebox and your drawing will be preserved.
Code: Select all
Dim gfx As Graphics
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim bmp As Bitmap = New Bitmap(PictureBox1.Width, PictureBox1.Height)
PictureBox1.Image = bmp
gfx = Graphics.FromImage(picturebox1.Image)
End Sub
Private Sub PictureBox1_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseMove
gfx.FillRectangle(Brushes.Black, New Rectangle(e.X, e.Y, 10, 10))
PictureBox1.Refresh()
End Sub
4 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023