The problem is demonstated by the following little program:
Private Sub btnGo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGo.Click
' RaiseEvent
End Sub
Private Sub Label1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Label1.Paint
Dim g As Graphics = e.Graphics
Dim img As Image
img = Image.FromFile("f:/myImage.bmp")
g.DrawImage(img, New Point(0, 0))
End Sub
The Image is shown in Label1 because the paint event is raised when the Form is launched. But how can I raise a paint event in the btnGo_Click Event??
I tried a lot of possibilities, but nothing worked. A solution is welcomed.
Just Invalidate() the Label:
This will force it to redraw and therefore also fire the
Paint()event.