Resources related to Hiding and showing a windows form

130 Views Asked by At

I have a form which has a picturebox and after clicking on a button another form will appear with a picture box containing the exact same picture. I use this line of code:

Image1.Image = vImage.Image

The thing is after I do this i need to hide the form and show it again to be able to see the changes. I cause me a blink for user which I want to avoid or do an equivalent of hiding and showing a form. How is it possible, the code looks like this:

Public Sub UpdatePhoto(ByVal FullName As String, ByVal vImage As System.Windows.Forms.PictureBox)
timAnimate.Enabled = False
Me.Text = FullName
Image1.Image = vImage.Image
Me.Refresh()
Me.Hide()
Me.Show()
Image1.Visible = True
Call ShowTheWindow()

End Sub

1

There are 1 best solutions below

0
On

I'm not quite following why you need to hide and show the form. Are you just trying to get the form to refresh? If so, just call:

Application.DoEvents()

or else you can try invalidating your control:

Image1.Invalidate()

That should cause your form to update. You shouldn't need to hide and show again. If this isn't your issue, let me know in more detail what your problem is.