📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form form1
BorderStyle = 0 'None
Caption = "Form1"
ClientHeight = 3945
ClientLeft = 0
ClientTop = 0
ClientWidth = 9000
LinkTopic = "Form1"
ScaleHeight = 3945
ScaleWidth = 9000
ShowInTaskbar = 0 'False
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command2
Caption = "保存路径"
Height = 525
Left = 5040
TabIndex = 9
Top = 3210
Width = 1665
End
Begin VB.CommandButton Command1
Caption = "动态显示汽车路线"
Height = 525
Left = 3180
TabIndex = 8
Top = 3210
Width = 1845
End
Begin VB.Timer Timer1
Left = 870
Top = 3270
End
Begin VB.Data Data1
Caption = "Data1"
Connect = "Access"
DatabaseName = "E:\编程技巧\数据库\汽车线路自动录入数据库\busstop.mdb"
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 345
Left = 750
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = "busstop"
Top = 2070
Visible = 0 'False
Width = 1275
End
Begin VB.CommandButton Command3
Caption = "退出"
Height = 510
Left = 6720
TabIndex = 2
Top = 3210
Width = 1890
End
Begin VB.Line Line1
Index = 5
X1 = 7335
X2 = 7365
Y1 = 1425
Y2 = 1425
End
Begin VB.Label Label1
AutoSize = -1 'True
BackColor = &H0080FFFF&
Caption = "东环站"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Index = 5
Left = 7080
TabIndex = 7
Top = 1290
Width = 720
End
Begin VB.Image Image1
Height = 390
Index = 5
Left = 7080
Picture = "form1.frx":0000
Top = 810
Width = 540
End
Begin VB.Line Line1
BorderColor = &H000000FF&
BorderWidth = 2
Index = 4
X1 = 6570
X2 = 7065
Y1 = 990
Y2 = 1005
End
Begin VB.Label Label1
AutoSize = -1 'True
BackColor = &H0080FFFF&
Caption = "新村站"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Index = 4
Left = 5970
TabIndex = 6
Top = 1260
Width = 720
End
Begin VB.Image Image1
Height = 390
Index = 4
Left = 5970
Picture = "form1.frx":0B3A
Top = 810
Width = 540
End
Begin VB.Line Line1
BorderColor = &H000000FF&
BorderWidth = 2
Index = 3
X1 = 5190
X2 = 5970
Y1 = 990
Y2 = 990
End
Begin VB.Label Label1
AutoSize = -1 'True
BackColor = &H0080FFFF&
Caption = "公园站"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Index = 3
Left = 4560
TabIndex = 5
Top = 1260
Width = 720
End
Begin VB.Image Image1
Height = 390
Index = 3
Left = 4620
Picture = "form1.frx":1674
Top = 810
Width = 540
End
Begin VB.Line Line1
BorderColor = &H000000FF&
BorderWidth = 2
Index = 2
X1 = 4020
X2 = 4590
Y1 = 990
Y2 = 990
End
Begin VB.Label Label1
AutoSize = -1 'True
BackColor = &H0080FFFF&
Caption = "烟厂站"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Index = 2
Left = 3420
TabIndex = 4
Top = 1260
Width = 720
End
Begin VB.Image Image1
Height = 390
Index = 2
Left = 3450
Picture = "form1.frx":21AE
Top = 840
Width = 540
End
Begin VB.Line Line1
BorderColor = &H000000FF&
BorderWidth = 2
Index = 1
X1 = 2700
X2 = 3420
Y1 = 990
Y2 = 1020
End
Begin VB.Label Label1
AutoSize = -1 'True
BackColor = &H0080FFFF&
Caption = "大桥站"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Index = 1
Left = 2160
TabIndex = 3
Top = 1290
Width = 720
End
Begin VB.Image Image1
Height = 390
Index = 1
Left = 2130
Picture = "form1.frx":2CE8
Top = 810
Width = 540
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "1路车路线图"
BeginProperty Font
Name = "宋体"
Size = 18
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 435
Left = 3345
TabIndex = 1
Top = 240
Width = 2385
End
Begin VB.Image Image1
Height = 390
Index = 0
Left = 1020
Picture = "form1.frx":3822
Top = 1110
Width = 540
End
Begin VB.Label Label1
AutoSize = -1 'True
BackColor = &H0080FFFF&
Caption = "南关站"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Index = 0
Left = 990
TabIndex = 0
Top = 1560
Width = 720
End
Begin VB.Line Line1
BorderColor = &H000000FF&
BorderWidth = 2
Index = 0
X1 = 1560
X2 = 2160
Y1 = 1320
Y2 = 990
End
End
Attribute VB_Name = "form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Dim x1 As Long
Dim y1 As Long
Dim j As Integer
Dim i As Integer
Private Type POINTAPI
X As Long
Y As Long
End Type
Private Sub Form_Load()
Data1.DatabaseName = App.Path & "\busstop.mdb"
End Sub
Private Sub Form_Activate()
For i = 1 To 4
Image1(i).Left = Left(Data1.Recordset.Fields(i), 5)
Image1(i).Top = Right(Data1.Recordset.Fields(i), 5)
Line1(i - 1).x1 = Image1(i - 1).Left + Image1(i - 1).Width
Line1(i - 1).y1 = Image1(i - 1).Top + Image1(i - 1).Height / 2
Line1(i - 1).X2 = Image1(i).Left
Line1(i - 1).Y2 = Image1(i).Top + Image1(i).Height / 2
Line1(i).x1 = Image1(i).Left + Image1(i).Width
Line1(i).y1 = Image1(i).Top + Image1(i).Height / 2
Line1(i).X2 = Image1(i + 1).Left
Line1(i).Y2 = Image1(i + 1).Top + Image1(i + 1).Height / 2
Label1(i).Top = Image1(i).Top + Image1(i).Height + 100
Label1(i).Left = Image1(i).Left
Next i
End Sub
Private Sub Image1_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
j = Index
End Sub
Private Sub Image1_MouseUp(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim mouse As POINTAPI
GetCursorPos mouse
If j > 0 And j < 5 Then
Image1(j).Left = mouse.X * 15 - Me.Left
Image1(j).Top = mouse.Y * 15 - Me.Top
Line1(j - 1).x1 = Image1(j - 1).Left + Image1(j - 1).Width
Line1(j - 1).y1 = Image1(j - 1).Top + Image1(j - 1).Height / 2
Line1(j - 1).X2 = Image1(j).Left
Line1(j - 1).Y2 = Image1(j).Top + Image1(j).Height / 2
Line1(j).x1 = Image1(j).Left + Image1(j).Width
Line1(j).y1 = Image1(j).Top + Image1(j).Height / 2
Line1(j).X2 = Image1(j + 1).Left
Line1(j).Y2 = Image1(j + 1).Top + Image1(j + 1).Height / 2
Label1(j).Top = Image1(j).Top + Image1(j).Height + 100
Label1(j).Left = Image1(j).Left
End If
End Sub
Private Sub Timer1_Timer()
i = i + 1
If i < 6 Then
Image1(i).Visible = True
Label1(i).Visible = True
Line1(i).Visible = True
End If
If i = 7 Then
For k = 0 To 5
Image1(k).Visible = False
Label1(k).Visible = False
Line1(k).Visible = False
Next k
i = -1
End If
End Sub
Private Sub Command1_Click()
Data1.Refresh
For i = 1 To 4
Image1(i).Left = Left(Data1.Recordset.Fields(i), 5)
Image1(i).Top = Right(Data1.Recordset.Fields(i), 5)
Line1(i - 1).x1 = Image1(i - 1).Left + Image1(i - 1).Width
Line1(i - 1).y1 = Image1(i - 1).Top + Image1(i - 1).Height / 2
Line1(i - 1).X2 = Image1(i).Left
Line1(i - 1).Y2 = Image1(i).Top + Image1(i).Height / 2
Line1(i).x1 = Image1(i).Left + Image1(i).Width
Line1(i).y1 = Image1(i).Top + Image1(i).Height / 2
Line1(i).X2 = Image1(i + 1).Left
Line1(i).Y2 = Image1(i + 1).Top + Image1(i + 1).Height / 2
Label1(i).Top = Image1(i).Top + Image1(i).Height + 100
Label1(i).Left = Image1(i).Left
Next i
i = 0
Timer1.Interval = 500
End Sub
Private Sub Command2_Click()
Timer1.Interval = 0
For k = 0 To 5
Image1(k).Visible = True
Line1(k).Visible = True
Label1(k).Visible = True
Next k
Data1.Recordset.Edit
For i = 1 To 5
Data1.Recordset.Fields(i) = Format(Image1(i).Left, "000##") & Format(Image1(i).Top, "000##")
Next i
Data1.Recordset.Update
Data1.Refresh
End Sub
Private Sub Command3_Click()
End
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -