Программирование в Бейсике

Курсовой проект - Компьютеры, программирование

Другие курсовые по предмету Компьютеры, программирование

ut #2, a$

Select Case a$

Case "автобус": Input #2, arBusNumber(Mis, arBusCount(Mis))

Case "водитель": Input #2, arDriveName(Mis, arBusCount(Mis))

Case "кондуктор": Input #2, arConductorName(Mis, arBusCount(Mis))

arBusCount(Mis) = arBusCount(Mis) + 1

Case "остановка": Input #2, arStayName(Mis, arStayCount(Mis))

Input #2, arStayAbsciss(Mis, arStayCount(Mis))

Input #2, arStayOrdinata(Mis, arStayCount(Mis))

arStayCount(Mis) = arStayCount(Mis) + 1

End Select

Loop

Close 2

End Sub

Private Sub Image1_Click(Index As Integer)

Misk = Index

For i = 0 To (AllBuses - 1)

Image1(i).Picture = LoadPicture("c:\ Курсовая моя\Иконки \Blue Bus.ico")

Next i

For i = 0 To (arBusCount(Mis) - 1)

If Mis <> 0 Then

a = i

For j = 0 To (Mis - 1)

i = i + arBusCount(j)

Next j

If i = Index Then

Frame1.Visible = False

Label4.Caption = arBusNumber(Mis, a)

Text1.Text = arDriveName(zmis, a)

Text2.Text = arConductorName(Mis, a)

Me.Label13.Caption = Str$(Fuel(Index))

Me.Image1(i).Picture = LoadPicture("c:\ Курсовая моя\Иконки \Purple Bus.ico")

End If

i = a

GoTo 1

Else

If i = Index Then

Frame1.Visible = False

Label4.Caption = arBusNumber(Mis, i)

Text1.Text = arDriveName(Mis, i)

Text2.Text = arConductorName(Mis, i)

Me.Label13.Caption = Str$(Fuel(Index))

Me.Image1(i).Picture = LoadPicture("c:\ Курсовая моя\Иконки \Purple Bus.ico")

End If

End If

1: Next i

End Sub

Private Sub Image1_DragOver(Index As Integer, Source As Control, X As Single, Y As Single, State As Integer)

Pisk = Index

End Sub

Private Sub Image2_Click(Index As Integer)

If Misk <> 999 Then

If Image1(Misk).Visible = True Then

x0(Mis, Misk) = Val(arStayAbsciss(Mis, Index))

y0(Mis, Misk) = Val(arStayOrdinata(Mis, Index))

If x0(Mis, Misk) = Val(arStayAbsciss(Mis, Index)) _

Then arStayPast(Mis, Misk) = Index

If arStayPast(Mis, Misk) = (arStayCount(Mis) - 1) Then arStayEdit(Mis, Misk) = -1

If arStayPast(Mis, Misk) = 0 Then arStayEdit(Mis, Misk) = 1

End If

End If

End Sub

Private Sub Image3_Click()

If Misk <> 999 Then If Image1(Misk).Visible = True Then Fuel(Misk) = 100

End Sub

Private Sub mnuEditNext_Click()

If Misk <> 999 Then

If Image1(Misk).Visible = True Then

x0(Mis, Misk) = Val(arStayAbsciss(Mis, arStayPast(Mis, Misk) + arStayEdit(Mis, Misk)))

If x0(Mis, Misk) = Val(arStayAbsciss(Mis, arStayPast(Mis, Misk) + arStayEdit(Mis, Misk))) _

Then arStayPast(Mis, Misk) = arStayPast(Mis, Misk) + arStayEdit(Mis, Misk)

End If

End If

End Sub

Private Sub mnuEditPast_Click()

If Misk <> 999 Then

If Image1(Misk).Visible = True Then

x0(Mis, Misk) = Val(arStayAbsciss(Mis, arStayPast(Mis, Misk)))

End If

End If

End Sub

Private Sub mnuMove_Click()

If MovePossible = True Then

Me.mnuMove.Caption = "Включить режим: передвижение автобусов"

For i = 0 To (AllBuses - 1)

Image1(i).DragMode = 0

Next i

MovePossible = False

Exit Sub

End If

If MovePossible = False Then

Me.mnuMove.Caption = "Включить: режим выбора автобуса"

MovePossible = True

For i = 0 To (AllBuses - 1)

Image1(i).DragMode = 1

Next i

End If

End Sub

Private Sub Picture1_DragDrop(Source As Control, X As Single, Y As Single)

If Val(arStayAbsciss(Mis, arStayPast(Mis, Pisk))) > Val(arStayAbsciss(Mis, arStayPast(Mis, Pisk) + arStayEdit(Mis, Pisk))) _

Then

For i = Val(arStayAbsciss(Mis, arStayPast(Mis, Pisk))) To Val(arStayAbsciss(Mis, arStayPast(Mis, Pisk) + arStayEdit(Mis, Pisk))) Step -1

If i = Fix(X) Then x0(Mis, Pisk) = X

Next i

Else

For i = Val(arStayAbsciss(Mis, arStayPast(Mis, Pisk))) To Val(arStayAbsciss(Mis, arStayPast(Mis, Pisk) + arStayEdit(Mis, Pisk))) Step 1

If i = Fix(X) Then x0(Mis, Pisk) = X

Next i

End If

End Sub

Private Sub Timer1_Timer()

For i = 0 To (AllBuses - 1)

Fuel(i) = Fuel(i) - 1 / (1000 * Me.Timer1.Interval)

If i = Misk Then Me.Label13.Caption = Str$(Fuel(Misk))

If Fuel(i) = 0 Then Fuel(i) = 100

Next i

For z = 0 To (Combo1.ListCount - 1)

For i = 0 To (arBusCount(z) - 1)

If z <> 0 Then

a = i

For j = 0 To (z - 1)

i = i + arBusCount(j)

Next j

End If

If arStayPast(z, i) = (arStayCount(z) - 1) Then arStayEdit(z, i) = -1

If arStayPast(z, i) = 0 Then arStayEdit(z, i) = 1

If Val(arStayAbsciss(z, arStayPast(z, i))) > Val(arStayAbsciss(z, arStayPast(z, i) + arStayEdit(z, i))) _

Then arCoordEdit(z, i) = -1

If Val(arStayAbsciss(z, arStayPast(z, i))) < Val(arStayAbsciss(z, arStayPast(z, i) + arStayEdit(z, i))) _

Then arCoordEdit(z, i) = 1

If Val(arStayAbsciss(z, arStayPast(z, i))) = Val(arStayAbsciss(z, arStayPast(z, i) + arStayEdit(z, i))) _

Then arCoordEdit(z, i) = 0

k(z, i) = (Val(arStayOrdinata(z, arStayPast(z, i))) - Val(arStayOrdinata(z, arStayPast(z, i) + arStayEdit(z, i)))) / _

(Val(arStayAbsciss(z, arStayPast(z, i))) - Val(arStayAbsciss(z, arStayPast(z, i) + arStayEdit(z, i))))

b(z, i) = Val(arStayOrdinata(z, arStayPast(z, i))) - k(z, i) * Val(arStayAbsciss(z, arStayPast(z, i)))

Dim c As Single

c = Cos(Atn(k(z, i)))

x0(z, i) = x0(z, i) + c * 2 * arCoordEdit(z, i)

y0(z, i) = k(z, i) * x0(z, i) + b(z, i)

Image1(i).Move x0(z, i) - Image1(i).Width / 2, y0(z, i) - Me.Image1(i).Height / 2

If arCoordEdit(z, i) = 1 Then

If x0(z, i) >= Val(arStayAbsciss(z, arStayPast(z, i) + arStayEdit(z, i))) _

Then arStayPast(z, i) = arStayPast(z, i) + arStayEdit(z, i)

End If

If arCoordEdit(z, i) = -1 Then

If x0(z, i) <= Val(arStayAbsciss(z, arStayPast(z, i) + arStayEdit(z, i))) _

Then arStayPast(z, i) = arStayPast(z, i) + arStayEdit(z, i)

End If

If z <> 0 Then i = a

Next i

Next z

End Sub

Public Static Sub First_Stay_of_Buses()

For z = 0 To (Combo1.ListCount - 1)

For i = 0 To (arBusCount(z) - 1)

a = i

If z <> 0 Then

a = i

For j = 0 To (z - 1)

i = i + arBusCount(j)

Next j

End If

If a = 0 Then

arStayEdit(z, i) = 1

arStayPast(z, i) = 0

Me.Image1(i).Move arStayAbsciss(z, 0) - Image1(i).Width / 2, _

arStayOrdinata(z, 0) - Image1(i).Height / 2

x0(z, i) = Val(arStayAbsciss(z, 0)): y0(z, i) = Val(arStayOrdinata(z, 0))

MsgBox Str$(z) + " - " + Str$(i) + " - " + Str$(X0(z, i)) + " " + Str$(Y0(z, i))

Else

arStayEdit(z, i) = 1

arStayPast(z, i) = arStayPast(z, i - 1) + 1

Me.Image1(i).Move arStayAbsciss(z, arStayPast(z, i)) _

- Image1(i).Width / 2, _

arStayOrdinata(z, arStayPast(z, i)) _

- Image1(i).Height / 2

x0(z, i) = Val(arStayAbsciss(z, arStayPast(z, i)))

y0(z, i) = Val(arStayOrdinata(z, arStayPast(z, i)))

MsgBox Str$(z) + " - " + Str$(i) + " - " + Str$(X0(z, i)) + " " + Str$(Y0(z, i))

End If

i = a

1: Next i

Next z

End Sub