MsgBox "Файл свободных автобусов не найден!!!" + vbCrLf + _
"Проверьте его наличие : 'c:\ Курсовая моя\Свободные автобусы.txt'"
Exit Sub
End If
Combo3.Enabled = True
Combo5.Enabled = True
End Sub
Private Sub Command13_Click()
If Text8.Text = "" Then MsgBox "Напишитеназваниемаршруту!!!": Exit Sub
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 Append As 1
Print #1, Text8.Text
Close 1
Open "c:\курсоваямоя\" + Text8.Text + ".txt" For Output As 3
For zzz = 0 To (Combo6.ListCount - 1)
Print #3, "автобус,", arBusNumber(LinesCount - 1, zzz)
Print #3, "водитель,", arDriveName(LinesCount - 1, zzz)
Print #3, "кондуктор,", arConductorName(LinesCount - 1, zzz)
Next zzz
For i = 0 To (Combo7.ListCount - 1)
Print #3, "остановка,", nama(LinesCount - 1, i), ",", Combo7.List(i)
Next i
Close 3
Open "c:\ Курсоваямоя\Свободныеавтобусы.txt" For Output As 6
For i = 0 To (Combo5.ListCount - 1)
Print #6, Combo5.List(i)
Next i
Close 6
mnuNewLine_Click
End Sub
Private Sub Command14_Click()
Frame2.Visible = False
End Sub
Private Sub Command15_Click()
Frame1.Visible = False
End Sub
Private Sub Command16_Click()
IfText9.Text = "" ThenMsgBox "Напишите название остановки!!!" Else _
nama(LinesCount - 1, Combo7.ListIndex) = Text9.Text
End Sub
Private Sub Command17_Click()
Picture2.Cls
Combo6.Clear: Combo6.Enabled = False
Combo5.Enabled = False
Text6.Text = "": Text6.Enabled = False
Text5.Text = "": Text5.Enabled = False
Command11.Enabled = False
Combo7.Enabled = False: Combo7.Clear
Text9.Text = "": Text9.Enabled = False
Command16.Enabled = False: Command13.Enabled = False
End Sub
Private Sub Command2_Click()
If Text1.Text = "" Or Text2.Text = "" Or Text3.Text = "" Then
MsgBox "Все поля должны быть заполнены!!!"
Exit Sub
End If
Select Case DooM
Case False: arDriveName(Mis, Misk) = Text2.Text
arConductorName(Mis, Misk) = Text3.Text
Case True: arBusNumber(Mis, Combo2.ListCount) = LTrim(Str$(Mis + 1) + Combo3.List(Mi))
arDriveName(Mis, Combo2.ListCount) = Text2.Text
arConductorName(Mis, Combo2.ListCount) = Text3.Text
Combo2.AddItem arBusNumber(Mis, Combo2.ListCount), Combo2.ListCount
Combo3.RemoveItem Mi
End Select
End Sub
Private Sub Command3_Click()
Doomy = True
Picture1.Cls
Command4.Enabled = True
Command5.Enabled = True
Command6.Enabled = True
End Sub
Private Sub Command4_Click()
If Doomy = True Then
If disk <> 999 Then
Image1(disk).Visible = False
Label14(disk).Visible = False
Combo4.List(disk) = " - "
End If
disk = 999
End If
End Sub
Private Sub Command5_Click()
Text4.Enabled = True
If Doomy = True Then Exit Sub
If disk <> 999 Then
If Do_Do = True Then
IfText4.Text = "" Then
MsgBox "напишите название остановки!!!"
Else
arStayName(Mis, disk) = Text4.Text
For i = 0 To 35
If Label14(i).Caption = Combo4.List(disk) Then Label14(i).Caption = Text4.Text
Next i
Me.Combo4.List(disk) = Text4.Text
Do_Do = False
End If
End If
End If
End Sub
Private Sub Command6_Click()
If Boom = True Then
If disk <> 999 Then Image1(disk).DragMode = 1
Else
If disk <> 999 Then Image1(disk).DragMode = 0
Boom = True
End If
End Sub
Private Sub Command7_Click()
Open "c:\Курсоваямоя\" + Combo1.List(Mis) + ".txt" For Output As 5
For i = 0 To (Combo2.ListCount - 1)
If Combo2.List(i) <> " - " Then
Print #5, "автобус,", Combo2.List(i)
Print #5, "водитель,", arDriveName(Mis, i)
Print #5, "кондуктор,", arConductorName(Mis, i)
End If
Next i
If Command10.Caption = "Сохранитьвсесделанныеизменения" Then
For i = 0 To (Combo4.ListCount - 1)
If Combo4.List(i) <> " - " Then _
Print #5, "остановка,", arStayName(Mis, i), ",", arStayAbsciss(Mis, i), ",", arStayOrdinata(Mis, i)
Next i
Else
For i = 0 To (Combo4.ListCount - 1)
If Combo4.List(i) <> " - " Then _
Print #5, "остановка,", arName(Mis, i), ",", arAbsciss(Mis, i), ",", arOrdinata(Mis, i)
Next i
End If
Close 5
Open "c:\ Курсовая моя\Свободные автобусы.txt" ForOutputAs 6
For i = 0 To (Combo3.ListCount - 1)
Print #6, Combo3.List(i)
Next i
Close 6
End Sub
Private Sub Command8_Click()
If DooM = True Then MsgBox "Нечегоудалять!!!"
If DooM = False Then
Combo2.List(Misk) = " - "
IfLen(Dir("c:\ Курсовая моя\Свободные автобусы.txt")) = 0 Then
MsgBox "Файл маршрутов не найден!!!" + vbCrLf + _
"Проверьте его наличие : 'c:\ Курсовая моя\Свободные автобусы.txt'"
Exit Sub
End If
Open "c:\ Курсоваямоя\Свободныеавтобусы.txt" For Append As 7
Print #7, arBusNumber(Mis, Misk)
Close 7
End If
End Sub
Private Sub Command9_Click()
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 Output As 4
For i = 0 To (Combo1.ListCount - 1)
If i <> Mis Then Print #4, Combo1.List(i)
Next i
Close 4
Open "c:\Êóðñîâàÿ ìîÿ\" + Combo1.List(Mis) + ".txt" For Output As 4
Close 4
End Sub
Private Sub Form_Load()
aa = 0
q = 999
For i = 1 To 35
Load Image1(i)
Load Label14(i)
Me.Image1(i).Visible = False
Me.Label14(i).Visible = False
Next i
disk = 999
End Sub
Private Sub Image1_Click(Index As Integer)
w = Image1(0).Width / 2
If q = 0 Then
Picture1.PSet (Image1(Index).Left, Image1(Index).Top)
Combo4.Clear
End If
If food = True Then
Command10.Caption = "Çàïîìíèòü"
arName(Mis, q) = arStayName(Mis, Index)
arAbsciss(miss, q) = arStayAbsciss(Mis, Index)
arOrdinata(miss, q) = arStayOrdinata(Mis, Index)
Combo4.AddItem arName(Mis, q)
Picture1.Line -(arStayAbsciss(Mis, Index), arStayOrdinata(Mis, Index))
q = q + 1
Else
disk = Index
Combo4.ListIndex = disk
End If
End Sub
Private Sub mnuEditLine_Click()
Combo1.Clear
Me.Frame1.Visible = True
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
End Sub
Private Sub mnuFree_Click()
If Len(Dir("c:\ Курсоваямоя\Свободныеавтобусы.txt")) = 0 Then
MsgBox " Файл маршрутов не найден!!!" + vbCrLf + _
" Проверьте его наличие: 'c:\ Курсовая моя\Свободные автобусы.txt"
ExitSub
EndIf
Retval = Shell("NotePad.exec:\ Курсовая моя\Свободные автобусы.txt", 1)
End Sub
Private Sub mnuLines_Click()
Form2.Show
End Sub
Public Static Sub 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_DragOver(Index As Integer, Source As Control, X As Single, Y As Single, State As Integer)
If e = 0 Then
mx = X
my = Y
e = 1
End If
End Sub
Private Sub mnuNewLine_Click()
zzz = 0
Frame1.Visible = False
Frame2.Visible = True
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
i = 0
Open "c:\ Курсовая моя\Свободные автобусы.txt" ForInputAs 3
Do While Not EOF(3)
Input #3, arFreeBuses(i)
Combo5.AddItem arFreeBuses(i)
i = i + 1
Loop
Close 3
End Sub
Private Sub Picture1_DragDrop(Source As Control, X As Single, Y As Single)
Source.Move X - mx, Y - my: Label14(disk).Move X - mx + w * 2, Y - my
arStayAbsciss(Mis, disk) = Str$(X - mx)
arStayOrdinata(Mis, disk) = Str$(Y - my)
e = 0
Boom = False
Command6_Click
End Sub
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Doomy Then
If Text4.Text = "" Then MsgBox "Напишитеназваниеостановки!!!": Exit Sub
If Do_Do = False Then
Exit Sub
Else
If Text4.Text = "" Then MsgBox " Напишите название остановки!!!": Exit Sub
Image1(Combo4.ListCount).Visible = True
Image1(Combo4.ListCount).Move X - w, Y - w
Me.Label14(Combo4.ListCount).Visible = True
Me.Label14(Combo4.ListCount).Move Image1(Combo4.ListCount).Left + 2 * w, Image1(Combo4.ListCount).Top
Me.Label14(Combo4.ListCount).Caption = Text4.Text
arStayAbsciss(Mis, Combo4.ListCount) = Str$(X - w): arStayOrdinata(Mis, Combo4.ListCount) = (Y - w)
arStayName(Mis, Combo4.ListCount) = Text4.Text
Me.Combo4.AddItem arStayName(Mis, Combo4.ListCount)
Me.Text4.Text = ""
End If
Else
Exit Sub
End If
End Sub
Private Sub Picture2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Combo7.Enabled = True
aa = aa + 1
Combo7.AddItem Str$(X) + "," + Str$(Y)
nama(LinesCount - 1, aa - 1) = Str$(aa - 1)
If aa <> 1 Then
Me.Picture2.Line -(X, Y)
Command13.Enabled = True
Else
Me.Picture2.PSet (X, Y)
End If
x0 = X: y0 = Y
End Sub
Private Sub Text4_Change()
Do_Do = True
End Sub
Private Sub Text9_Change()
Command16.Enabled = True
End Sub
Form2
Dim Boom As Boolean
Dim MovePossible As Boolean
Dim arLinesName(0 To 30) As String, LinesCount As Integer '30 max маршрутов
Dim arBusNumber(0 To 30, 0 To 25) As String, arBusCount(0 To 30) As Integer
Dim AllBuses As Integer '25 - max автлбусов
Dim arDriveName(0 To 30, 0 To 25) As String
Dim arConductorName(0 To 30, 0 To 25) As String
Dim arStayName(0 To 30, 0 To 35) As String ' 35 - max остановокнаодноммаршруте
Dim arStayAbsciss(0 To 30, 0 To 35) As String
Dim arStayOrdinata(0 To 30, 0 To 35) As String
Dim arStayCount(0 To 30) As Integer
Dim arStayPast(0 To 30, 0 To 25) As Integer последняяостановкаавтобуса
DimarStayEdit(0 To 30, 0 To 25) AsIntegerв какую сторону изменять остановки
Dim arCoordEdit(0 To30,Dim k(0 To 30, 0 To 25) As Single вкакуюсторонуизменятькоординаты
Dim b(0 To 30, 0 To 25) As Single угловойкоэффициентпридвижении
Dim x0(0 To 30, 0 To 25) As Single
Dim y0(0 To 30, 0 To 25) As Single
Dim mx As Single '
Dim my As Single, p As Integer, Pisk As Integer
Public Mis As Integer определенныймаршрут
Public Misk As Integer определенныйавтобус
Dim i As Integer
Dim w As Single
Const t0 = 4: Const t1 = 7: Const t2 = 10: Const t3 = 13
Const t4 = 15: Const t5 = 17: Const t6 = 20: Const t7 = 23
Dim Fuel(0 To 750) As Single
Private Sub Combo1_Click()
Me.mnuEditBuses.Enabled = True
Me.mnuMove.Enabled = True
Me.Command1.Enabled = True
For i = 0 To (AllBuses - 1)
Image1(i).Picture = LoadPicture("c:\ Курсовая моя\Иконки\Blue Bus.ico")
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