Tutorial Programming

Tutorial basic, Visual Studio VB.NET 2013 Pengunaan Animation


Hallo sahabat saya akan menjelaskan Pengunaan Animation pada visual studio 2013, oke langsung aja



Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.TickIf PictureBox1.Left < Me.Width ThenPictureBox1.Left = PictureBox1.Left + 10
Else
PictureBox1.Left = 0
End If
End Sub






Private Sub BtnRoll_Click(sender As Object, e As EventArgs) Handles BtnRoll.Click
Timer1.Enabled = True
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
Dim t As Integer
t = 0
Do
MyPicBox.Refresh()
Dim n As Integer
Dim myPen As Pen
myPen = New Pen(Drawing.Color.DarkTurquoise, 10)
Dim myGraphics As Graphics = MyPicBox.CreateGraphics
n = Int(6 * Rnd()) + 1
Select Case n
Case 1
myGraphics.DrawEllipse(myPen, 80, 80, 10, 10)
Case 2
myGraphics.DrawEllipse(myPen, 40, 40, 10, 10)
myGraphics.DrawEllipse(myPen, 120, 120, 10, 10)
Case 3
myGraphics.DrawEllipse(myPen, 40, 40, 10, 10)
myGraphics.DrawEllipse(myPen, 80, 80, 10, 10)
myGraphics.DrawEllipse(myPen, 120, 120, 10, 10)
Case 4
myGraphics.DrawEllipse(myPen, 40, 40, 10, 10)
myGraphics.DrawEllipse(myPen, 120, 40, 10, 10)
myGraphics.DrawEllipse(myPen, 40, 120, 10, 10)
myGraphics.DrawEllipse(myPen, 120, 120, 10, 10)
Case 5
myGraphics.DrawEllipse(myPen, 40, 40, 10, 10)
myGraphics.DrawEllipse(myPen, 120, 40, 10, 10)
myGraphics.DrawEllipse(myPen, 80, 80, 10, 10)
myGraphics.DrawEllipse(myPen, 40, 120, 10, 10)
myGraphics.DrawEllipse(myPen, 120, 120, 10, 10)
Case 6
myGraphics.DrawEllipse(myPen, 40, 40, 10, 10)
myGraphics.DrawEllipse(myPen, 120, 40, 10, 10)
myGraphics.DrawEllipse(myPen, 40, 80, 10, 10)
myGraphics.DrawEllipse(myPen, 120, 80, 10, 10)
myGraphics.DrawEllipse(myPen, 40, 120, 10, 10)
myGraphics.DrawEllipse(myPen, 120, 120, 10, 10)
End Select
t = t + 1
Loop Until t > 1000
Timer1.Enabled = False
End Sub





Public Class Form1
Dim m, a, b, c As Integer
Private Sub BtnSpin_Click(sender As Object, e As EventArgs) Handles BtnSpin.Click
Timer1.Enabled = True
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
m = m + 10
If m < 1000 Then
a = Int(1 + Rnd() * 3)
b = Int(1 + Rnd() * 3)
c = Int(1 + Rnd() * 3)
Select Case a
Case 1
PictureBox1.Image = Image.FromFile(“C:\Users\Toshiba\Documents\Liew Folder\vb2010\vb2010_Image\apple.gif”)
Case 2
PictureBox1.Image = Image.FromFile(“C:\Users\Toshiba\Documents\Liew Folder\vb2010\vb2010_Image\grape.gif”)
Case 3
PictureBox1.Image = Image.FromFile(“C:\Users\Toshiba\Documents\Liew Folder\vb2010\vb2010_Image\strawberry.gif”)
End Select
Select Case b
Case 1
PictureBox2.Image = Image.FromFile(“C:\Users\Toshiba\Documents\Liew Folder\vb2010\vb2010_Image\apple.gif”)
Case 2
PictureBox2.Image = Image.FromFile(“C:\Users\Toshiba\Documents\Liew Folder\vb2010\vb2010_Image\grape.gif”)
Case 3
PictureBox2.Image = Image.FromFile(“C:\Users\Toshiba\Documents\Liew Folder\vb2010\vb2010_Image\strawberry.gif”)
End Select
Select Case c
Case 1
PictureBox3.Image = Image.FromFile(“C:\Users\Toshiba\Documents\Liew Folder\vb2010\vb2010_Image\apple.gif”)
Case 2
PictureBox3.Image = Image.FromFile(“C:\Users\Toshiba\Documents\Liew Folder\vb2010\vb2010_Image\grape.gif”)
Case 3
PictureBox3.Image = Image.FromFile(“C:\Users\Toshiba\Documents\Liew Folder\vb2010\vb2010_Image\strawberry.gif”)
End Select
Else
Timer1.Enabled = False
m = 0
If a = b And b = c Then
LblMsg.Text = “Jackpot! You won $1,000,000?
Else
LblMsg.Text = “No luck, try again”
End If
End If
End Sub
End Class




Sekian tutorial saya sahabat semoga bermanfaat yah.

No comments:

Post a Comment

Tutorial Programming Designed by Templateism | Ary EJFA Copyright © 2015

Theme images by richcano. Powered by Blogger.