与隐藏和显示 Windows 窗体相关的资源
我有一个带有图片框的表单,单击按钮后会出现另一个表单,其中包含包含完全相同图片的图片框。 我使用这行代码:
Image1.Image = vImage.Image
事情是在我这样做之后,我需要隐藏表单并再次显示它以便能够看到更改。我让我对我想避免的用户眨眼,或者做相当于隐藏和显示表单的操作。怎么可能,代码是这样的:
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
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(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:
or else you can try invalidating your control:
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.