📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form BusSelect
Caption = "Form1"
ClientHeight = 7200
ClientLeft = 60
ClientTop = 450
ClientWidth = 3825
LinkTopic = "Form1"
ScaleHeight = 7200
ScaleWidth = 3825
StartUpPosition = 3 '窗口缺省
Begin VB.ListBox BusList1
Height = 2760
Left = 360
TabIndex = 5
Top = 2400
Width = 2895
End
Begin VB.CommandButton BusCmd1
Caption = "确定"
Height = 495
Left = 720
TabIndex = 4
Top = 5760
Width = 1215
End
Begin VB.TextBox BusTxt2
Height = 375
Left = 1680
TabIndex = 1
Text = "Text2"
Top = 1560
Width = 1575
End
Begin VB.TextBox BusTxt1
Height = 375
Left = 1680
TabIndex = 0
Text = "Text1"
Top = 720
Width = 1575
End
Begin VB.Label Label2
Caption = "终点:"
Height = 255
Left = 240
TabIndex = 3
Top = 1680
Width = 735
End
Begin VB.Label Label1
Caption = "起点:"
Height = 255
Left = 240
TabIndex = 2
Top = 840
Width = 615
End
End
Attribute VB_Name = "BusSelect"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub BusCmd1_Click() '查询
If BusTxt1 <> "" Then
If BusOption1.Value = True Then
Call selectbussite '站点信息查询
ElseIf BusOption2.Value = True Then
Call selectbusline '公交线路查询
ElseIf BusOption3.Value = True Then
If BusTxt2 <> "" Then
Call selectbestbusline '最优线路查询
Else
MsgBox "请输入查询信息", vbOKOnly, "提示信息"
x1 = -1
y1 = -1
BusImage.Cls
BusTxt2.SetFocus
End If
ElseIf BusOption10.Value = True Then
If BusCombo.Text <> "" Then
Select Case BusCombo.Text
Case "100米"
area = 500
Case "200米"
area = 1000
Case "500米"
area = 2500
Case "1000米"
area = 5000
End Select
Call bussiteside
Else
MsgBox "请选择范围", 48, "提示信息"
BusCombo.SetFocus
End If
ElseIf BusOption11.Value = True Then
Call buschang
End If
Else
MsgBox "请输入查询信息", vbOKOnly, "提示信息"
x1 = -1
y1 = -1
BusImage.Cls
BusTxt1.SetFocus
End If
End Sub
Private Sub BusCmd2_Click() '取消
x1 = -1
y1 = -1
BusImage.Cls
BusList1.Clear
BusTxt1.SetFocus
Call busclear
End Sub
Private Sub BusCombo_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Call BusCmd1_Click
End If
End Sub
Private Sub BusImage_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
If BusImage.Width > BusPicture.Width Then
dx = X - x1
If BusImage.Left + dx >= -BusHScroll.Max And BusImage.Left + dx <= 0 Then
BusImage.Left = BusImage.Left + dx
BusHScroll.Value = -BusImage.Left
End If
End If
If BusImage.Height > BusPicture.Height Then
dy = Y - y1
If BusImage.Top + dy >= -BusVScroll.Max And BusImage.Top + dy <= 0 Then
BusImage.Top = BusImage.Top + dy
BusVScroll.Value = -BusImage.Top
End If
End If
End If
End Sub
'Private Sub BusImage_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) '鼠标点击事件
' Label2.Caption = "(" & X & "," & Y & ")"
' If Button = 1 Then
' BusImage.Cls
' BusImage.Line (x1, y1)-(X, Y), , B
' BusImage.DrawWidth = 1
' End If
'End Sub
'Private Sub BusImage_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) '鼠标释放事件
' BusImage.Cls
' BusImage.DrawWidth = 3
'End Sub
Private Sub BusList1_Click()
For i = 0 To BusList1.ListCount - 1
'公交线路较果图
'=================================================================================================================
If BusList1.Selected(i) And i = 0 Then
If BusOption11.Value = True Then
n = i
BusSelectTimer1.Enabled = False
Call busline
End If
ElseIf BusList1.Selected(i) And i = 1 Then
If BusOption2.Value = True Then
n = i
BusSelectTimer1.Enabled = False
Call busline
ElseIf BusOption11.Value = True Then
n = i
BusSelectTimer1.Enabled = False
Call busline
End If
'=================================================================================================================
'站点较果图
'=================================================================================================================
ElseIf BusList1.Selected(i) And i > 1 Then
If BusOption1.Value = True Then
n = i
Call buslineshow
ElseIf BusOption2.Value = True Then
BusImage.Left = -BusHScroll.Max * (bussite(i - 1, 1) / BusImage.Width)
BusHScroll.Value = BusHScroll.Max * (bussite(i - 1, 1) / BusImage.Width)
BusImage.Top = -BusVScroll.Max * (bussite(i - 1, 2) / BusImage.Height)
BusVScroll.Value = BusVScroll.Max * (bussite(i - 1, 2) / BusImage.Height)
BusImage.Cls
n = i
siterad = 5
BusSelectTimer1.Enabled = True
ElseIf BusOption3.Value = True Then
If i <> BusList1.ListCount - 1 Then
n = i - 1
Call busline
End If
ElseIf BusOption10.Value = True Then
BusImage.Left = -BusHScroll.Max * (bussite(n - 1, 1) / BusImage.Width)
BusHScroll.Value = BusHScroll.Max * (bussite(n - 1, 1) / BusImage.Width)
BusImage.Top = -BusVScroll.Max * (bussite(n - 1, 2) / BusImage.Height)
BusVScroll.Value = BusVScroll.Max * (bussite(n - 1, 2) / BusImage.Height)
BusImage.Cls
n = i - 1
siterad = 5
BusSelectTimer1.Enabled = True
End If
End If
Next
End Sub
Private Sub BusOption1_Click() '站点信息查询
Label1.Visible = True
Label1.Caption = "请输入站点"
BusFrame2.Caption = BusOption1.Caption
BusLabel3.Visible = True
BusLabel3.Caption = "站 点:"
BusLabel4.Visible = False
BusTxt1.Visible = True
BusTxt2.Visible = False
BusCombo.Visible = False
Call busclear
End Sub
Private Sub BusOption10_Click()
Label1.Visible = False
BusFrame2.Caption = BusOption10.Caption
BusLabel3.Visible = True
BusLabel3.Caption = "站 点:"
BusLabel4.Visible = True
BusLabel4.Caption = "范 围:"
BusTxt1.Visible = True
BusTxt2.Visible = False
BusCombo.Visible = True
Call busclear
End Sub
Private Sub BusOption11_Click()
Label1.Visible = False
BusFrame2.Caption = BusOption11.Caption
BusLabel3.Visible = True
BusLabel3.Caption = "始 点:"
BusLabel4.Visible = True
BusLabel4.Caption = "终 点:"
BusTxt1.Visible = True
BusTxt2.Visible = True
BusCombo.Visible = False
Call busclear
End Sub
Private Sub BusOption2_Click() '公交线路查询
Label1.Visible = True
Label1.Caption = "请输入公交路线"
BusFrame2.Caption = BusOption2.Caption
BusLabel3.Caption = "公交线路:"
BusLabel4.Visible = False
BusTxt2.Visible = False
BusCombo.Visible = False
Call busclear
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -