Şekil 1
Şekil 2
Şekil 3
Şekil 4
Public Class Form1
Dim i As Integer = 0
Dim kirmizi As Graphics = Me.CreateGraphics
Dim sari As Graphics = Me.CreateGraphics
Dim yesil As Graphics = Me.CreateGraphics
Dim kare As Graphics = Me.CreateGraphics
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.Interval = 1000
Timer1.Enabled = True
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim X As Integer
X += 5
i = i + 1
If i > 0 And i <= 2 Then
‘kare şeklini oluşturuyoruz.
‘Aşağıda Brushes.Black ile şeklin arka plan rengi, X artış, 20 formda
‘ki üst kısımdaki boşluğu(top), 41 genişlik, 130 yüksekliği belirtir. kare.FillRectangle(Brushes.Black, X, 20, 41, 130)
‘yuvarlak kırmızı ışık şeklini oluşturuyorz.
kirmizi.FillEllipse(Brushes.Red, X, 25, 40, 40)
sari.FillEllipse(Brushes.Yellow, X, 65, 40, 40)
yesil.FillEllipse(Brushes.Green, X, 105, 40, 40)
ElseIf i > 2 And i <= 6 Then
kare.FillRectangle(Brushes.Black, X, 20, 41, 130)
kirmizi.FillEllipse(Brushes.Red, X, 25, 40, 40)
sari.FillEllipse(Brushes.White, X, 65, 40, 40)
yesil.FillEllipse(Brushes.White, X, 105, 40, 40)
ElseIf i > 6 And i <= 7 Then
kare.FillRectangle(Brushes.Black, X, 20, 41, 130)
kirmizi.FillEllipse(Brushes.White, X, 25, 40, 40)
sari.FillEllipse(Brushes.Yellow, X, 65, 40, 40)
yesil.FillEllipse(Brushes.White, X, 105, 40, 40)
ElseIf i > 7 And i <= 12 Then
kare.FillRectangle(Brushes.Black, X, 20, 41, 130)
kirmizi.FillEllipse(Brushes.White, X, 25, 40, 40)
sari.FillEllipse(Brushes.White, X, 65, 40, 40)
yesil.FillEllipse(Brushes.Green, X, 105, 40, 40)
ElseIf i > 12 Then
i = 3
End If
End Sub
End Class
Bir sonraki makalede buluşmak üzere. Bahadır ŞAHİN
0 comments:
Yorum Gönder