在VB.net中刷新或重画picturebox
我试图在我的vb应用程序中查看youtube验证码,但我不知道如何刷新/重画图片框。youtube验证码在,每次我刷新页面时验证码都在更改。如何使用vb.net中的按钮或计时器更改验证码。下面是我用来将验证码加载到picturebox的代码在VB.net中刷新或重画picturebox,vb.net,picturebox,Vb.net,Picturebox,我试图在我的vb应用程序中查看youtube验证码,但我不知道如何刷新/重画图片框。youtube验证码在,每次我刷新页面时验证码都在更改。如何使用vb.net中的按钮或计时器更改验证码。下面是我用来将验证码加载到picturebox的代码 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load captchaBox.Im
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
captchaBox.ImageLocation = "http://www.youtube.com/cimg"
End Sub
我尝试使用captchaBox.Refresh(),但它不起作用。我希望有人能帮助我。thx刷新只是重新绘制控件,它不会再次检索图像。您需要重置ImageLocation属性才能使其工作。例如,使用计时器:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
captchaBox.ImageLocation = "http://www.youtube.com/cimg"
Timer1.Enabled = True
Timer1.Interval = 1000
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
captchaBox.ImageLocation = "http://www.youtube.com/cimg"
End Sub
试试这个:
Private Sub Form1_Load() Handles MyBase.Load
Timer1.Start()
PictureBox1.ImageLocation = "http://www.youtube.com/cimg"
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
PictureBox1.Image = Nothing
PictureBox1.ImageLocation = "http://www.youtube.com/cimg"
End Sub