Курсовая работа: Программирование в Бейсике
Next
i
Me.Frame1.Visible
= True
Me.Label2.Visible
= True
Mi =
Mis
Mis
= Combo1.ListIndex
Me.Picture1.Visible
= True
Me.Label9.Visible
= True
arBusCount(Combo1.ListIndex)
= 0
arStayCount(Combo1.ListIndex)
= 0
If
Len(Dir("c:\Êóðñîâàÿ ìîÿ\"
+ Combo1.List(Mis) + ".txt")) = 0 Then
MsgBox " Файл
маршрутов не найден!!!" + vbCrLf + _
"Ïðîâåðüòå
åãî íàëè÷èå :
'c:\Êóðñîâàÿ ìîÿ\"
+ Combo1.List(Mis) + ".txt'"
Combo1.ListIndex
= Mi
Exit
Sub
Else
Work_With_Files
End
If
Picture1.Cls
For
i = 1 To 35
Me.Image2(i).Visible
= False
Me.Label14(i).Visible
= False
Next
i
Me.Picture1.PSet
(arStayAbsciss(Mis, 0), arStayOrdinata(Mis, 0))
w =
Me.Image2(0).Width / 2
Me.Image2(0).Move
arStayAbsciss(Mis, 0) - w, arStayOrdinata(Mis, 0) - w
Me.Label14(0).Move
Image2(0).Left + 2 * w, Image2(0).Top
Me.Label14(0).Caption
= arStayName(Mis, 0)
For
i = 0 To (arStayCount(Mis) - 1)
Me.Picture1.Line
-(arStayAbsciss(Mis, i), arStayOrdinata(Mis, i))
Me.Image2(i).Move
arStayAbsciss(Mis, i) - w, arStayOrdinata(Mis, i) - w
Me.Image2(i).Visible
= True
Me.Label14(i).Visible
= True
Me.Label14(i).Move
Image2(i).Left + 2 * w, Image2(i).Top
Me.Label14(i).Caption
= arStayName(Mis, i)
Next
i
For
i = 0 To (AllBuses - 1)
Image1(i).Visible
= False
Next
i
If
Boom = True Then Boom = False: First_Stay_of_Buses
For
i = 0 To (arBusCount(Combo1.ListIndex) - 1)
If
Mis <> 0 Then
a =
i
For
j = 0 To (Mis - 1)
i =
i + arBusCount(j)
Next
j
Me.Image1(i).Visible
= True
i =
a
GoTo
1
Else
Me.Image1(i).Visible
= True
End
If
1:
Next i
Me.Timer1
= True
If
Misk <> 999 Then If Image1(Misk).Visible = True Then Image1_Click (Misk)
t =
Time
tnow
= Val(Mid$(Str$(t), 1, 2))
If
tnow > t0 And tnow < t1 Or tnow > t2 And tnow < t3 Or tnow > t4
And tnow < t5 Or _
tnow
> t6 And tnow <= t7 Then Label8.Caption = "60 êì/÷":
Timer1.Interval = 5
If
tnow >= t1 And tnow <= t2 Or tnow >= t3 And tnow <= t4 Or tnow
>= t5 And tnow <= t6 Then _
Label8.Caption
= "30 êì/÷": Timer1.Interval = 10
If
tnow = 24 Or tnow >= 0 And tnow <= 4 Then Label8.Caption = " - ":
'Timer1.Enabled = False
Label13.Caption
= "100"
End
Sub
Private
Sub Command1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As
Single)
For
z = 0 To (Combo1.ListCount - 1)
Me.Picture1.PSet
(arStayAbsciss(z, 0), arStayOrdinata(z, 0))
For
i = 0 To (arStayCount(z) - 1)
Me.Picture1.Line
-(arStayAbsciss(z, i), arStayOrdinata(z, i)), QBColor(z + 3)
Next
i
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
Me.Image1(i).Visible
= True
i = a
GoTo
1
Else
Me.Image1(i).Visible
= True
End
If
1:
Next i
Next
z
End
Sub
Private
Sub Command1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As
Single)
Combo1_Click
End
Sub
Private
Sub Command2_Click()
Misk
= 999
Unload
Me
End
Sub
Private
Sub Form_Load()
Misk
= 999
Boom
= True
MovePossible
= False
If
Len(Dir("c:\ Курсовая моя\маршруты.txt")) = 0 Then
MsgBox " Файл
маршрутов не найден!!!" + vbCrLf + _
"
Проверьте его наличие: 'c:\ Курсовая моя\маршруты.txt'"
Combo1.Enabled
= False
Label11.Visible
= False
Exit
Sub
End
If
Open
"c:\ Курсовая моя\маршруты.txt" For Input As 1
LinesCount
= 0
Do
While Not EOF(1)
Input
#1, arLinesName(LinesCount)
Combo1.AddItem
arLinesName(LinesCount)
LinesCount
= LinesCount + 1
Loop
Close
1
AllBuses
= 0
For Mis
= 0 To (Combo1.ListCount - 1)
If
Len(Dir("c:\Курсовая моя\" + Combo1.List(Mis) + ".txt")) = 0 Then
MsgBox " Файл
маршрутов не найден!!!" + vbCrLf + _
"
Проверьте его наличие: 'c:\Курсовая\" + Combo1.List(Mis) + ".txt'"
Else
Work_With_Files
AllBuses
= AllBuses + arBusCount(Mis)
End
If
Next
Mis
Fuel(0)
= 100
For
i = 1 To (AllBuses - 1)
Load
Image1(i)
Fuel(i)
= 100
Next
i
For
i = 1 To 35
Load
Image2(i)
Load
Label14(i)
Next
i
End
Sub
Public
Static Sub Work_With_Files()
arBusCount(Mis)
= 0
arStayCount(Mis)
= 0
Open
"c:\Курсовая моя\" + Combo1.List(Mis) + ".txt" For Input As 2
Do
While Not EOF(2)
Input
#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
Страницы: 1, 2, 3, 4, 5, 6 |