الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

برنامج من صنعي race

بدأه Mostafa ashraf في 24 يوليو 2010 · 0 رد · 287 مشاهدة · في Microsoft Visual Basic.NET
مشاركة: واتساب X فيسبوك تيليجرام
#1

نقوم بوضع ثلاث صور سيارات(picture box) و اخلفية هي الطريق و زر

Private Sub Form1_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Enter

Dim a1, a2, a3 As Integer

Randomize()

Do While PictureBox1.Top > 0 And PictureBox2.Top > 0 And PictureBox3.Top > 0

a1 = Rnd()

a2 = Rnd()

a3 = Rnd()

PictureBox1.Top = PictureBox1.Top - a1

PictureBox2.Top = PictureBox2.Top - a2

PictureBox3.Top = PictureBox3.Top - a1

Loop

If PictureBox1.Top <= 0 And PictureBox2.Top <= 0 And PictureBox3.Top >= 0 Then

MsgBox(" Draw")

End If

If PictureBox1.Top <= 0 Then

MsgBox("Car 1 ....wins")

Else

If PictureBox2.Top <= 0 Then

MsgBox("Car 2 ....wins")

End If

If PictureBox3.Top <= 0 Then

MsgBox("Car 3 ....wins")

End If

End If

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim a1, a2, a3 As Integer

Randomize()

Do While PictureBox1.Top > 0 And PictureBox2.Top > 0 And PictureBox3.Top > 0

a1 = Rnd()

a2 = Rnd()

a3 = Rnd()

PictureBox1.Top = PictureBox1.Top - a1

PictureBox2.Top = PictureBox2.Top - a2

PictureBox3.Top = PictureBox3.Top - a3

Loop

If PictureBox1.Top <= 0 And PictureBox2.Top <= 0 And PictureBox3.Top >= 0 Then

MsgBox(" Draw")

End If

If PictureBox1.Top <= 0 Then

MsgBox("Car 1 ....wins")

Else

If PictureBox2.Top <= 0 Then

MsgBox("Car 2 ....wins")

End If

If PictureBox3.Top <= 0 Then

MsgBox("Car 3 ....wins")

End If

End If

PictureBox1.Top = 427

PictureBox2.Top = 427

PictureBox3.Top = 427

End Sub

مواضيع مشابهة