Resources related to Hiding and showing a windows form

。_饼干妹妹 提交于 2020-01-11 13:29:31

问题


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:


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.



来源:https://stackoverflow.com/questions/5116868/resources-related-to-hiding-and-showing-a-windows-form

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!