Основы офисного программирования и документы Word


Who As String) If StateOfBoat


Public Sub ONLeftBank( Who As String) If StateOfBoat = "LeftBank" Then 'пассажиров из лодки можно высадить на левый берег With WGCForm If ((Who = "All") Or (Who = "Man")) And (StateOfMan = "InBoat") Then 'можно высадить человека .Man.Top = .LeftBank.Top + 15: .Man.Left = .LeftBank.Left + 10 StateOfMan = "LeftBank" CountInBoat = CountInBoat - 1 End If If ((Who = "All") Or (Who = "Wolf")) And (StateOfWolf = "InBoat") Then 'можно высадить волка .Wolf.Top = .LeftBank.Top + 80: .Wolf.Left = .LeftBank.Left + 10 StateOfWolf = "LeftBank" CountInBoat = CountInBoat - 1 End If If ((Who = "All") Or (Who = "Goat")) And (StateOfGoat = "InBoat") Then 'можно высадить козу .Goat.Top = .LeftBank.Top + 140: .Goat.Left = .LeftBank.Left + 10 StateOfGoat = "LeftBank" CountInBoat = CountInBoat - 1 End If If ((Who = "All") Or (Who = "Cabbage")) And (StateOfCabbage = "InBoat") Then 'можно высадить капусту .Cabbage.Top = .LeftBank.Top + 200: .Cabbage.Left = .LeftBank.Left + 10 StateOfCabbage = "LeftBank" CountInBoat = CountInBoat - 1 End If End With ElseIf (Who = "Boat") Then 'Лодка переезжает на левый берег Crossing End If TestingState End Sub
Public Sub OnRightBank(Who As String) If StateOfBoat = "RightBank" Then 'пассажиров из лодки можно высадить на правый берег With WGCForm If ((Who = "All") Or (Who = "Man")) And (StateOfMan = "InBoat") Then 'можно высадить человека .Man.Top = .RightBank.Top + 15: .Man.Left = .RightBank.Left + 10 StateOfMan = "RightBank" CountInBoat = CountInBoat - 1 End If If ((Who = "All") Or (Who = "Wolf")) And (StateOfWolf = "InBoat") Then 'можно высадить волка .Wolf.Top = .RightBank.Top + 80: .Wolf.Left = .RightBank.Left + 10 StateOfWolf = "RightBank" CountInBoat = CountInBoat - 1 End If If ((Who = "All") Or (Who = "Goat")) And (StateOfGoat = "InBoat") Then 'можно высадить козу .Goat.Top = .RightBank.Top + 140: .Goat.Left = .RightBank.Left + 10 StateOfGoat = "RightBank" CountInBoat = CountInBoat - 1 End If If ((Who = "All") Or (Who = "Cabbage")) And (StateOfCabbage = "InBoat") Then 'можно высадить капусту .Cabbage.Top = .RightBank.Top + 200: .Cabbage.Left = .RightBank.Left + 10 StateOfCabbage = "RightBank" CountInBoat = CountInBoat - 1 End If End With ElseIf (Who = "Boat") Then 'Лодка переезжает на правый берег Crossing End If TestingState End Sub
Листинг 6.13.
Закрыть окно
Содержание раздела