Program 2 Write a Vb.net program for blinking an image.
Solotion
Step 1. Add Windows Form with Name P2_BlinkingImage.vb
Step 2. Drag and drop PictureBox control from Toolbox on the form
Step 3. Double click on blank area of form to add page load event
Step 4. Add Timer control on the form Double click on the Timer1 control to add tick event
Step 6. Insert following code in the program
Public Class P2_BlinkingImage
Dim cnt As Integer
Private Sub P2_BlinkingImage_Load(sender As Object, e As EventArgs) Handles MyBase.Load
PictureBox1.ImageLocation = "D:/Salunke Sir/Practical/P2A.png"
Timer1.Interval = 1000
cnt = 0
Timer1.Enabled = True
Timer1.Start()
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
cnt += 1
If cnt Mod 2 = 0 Then
PictureBox1.Hide()
Else
PictureBox1.Show()
End If
End Sub
End Class
Solotion
Step 1. Add Windows Form with Name P2_BlinkingImage.vb
Step 2. Drag and drop PictureBox control from Toolbox on the form
Step 3. Double click on blank area of form to add page load event
Step 4. Add Timer control on the form Double click on the Timer1 control to add tick event
Step 6. Insert following code in the program
Public Class P2_BlinkingImage
Dim cnt As Integer
Private Sub P2_BlinkingImage_Load(sender As Object, e As EventArgs) Handles MyBase.Load
PictureBox1.ImageLocation = "D:/Salunke Sir/Practical/P2A.png"
Timer1.Interval = 1000
cnt = 0
Timer1.Enabled = True
Timer1.Start()
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
cnt += 1
If cnt Mod 2 = 0 Then
PictureBox1.Hide()
Else
PictureBox1.Show()
End If
End Sub
End Class

Thanks for sharing the program
ReplyDelete