📄 form02.frm
字号:
VERSION 5.00
Object = "{9BD6A640-CE75-11D1-AF04-204C4F4F5020}#2.0#0"; "mo20.ocx"
Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "COMCTL32.OCX"
Begin VB.Form Form02
Caption = "华盛顿地图"
ClientHeight = 8400
ClientLeft = 1140
ClientTop = 1515
ClientWidth = 9585
LinkTopic = "Form1"
PaletteMode = 1 'UseZOrder
ScaleHeight = 8400
ScaleWidth = 9585
Begin VB.TextBox Text6
Height = 375
Left = 7560
TabIndex = 12
Text = "Text1"
Top = 4920
Width = 1815
End
Begin VB.TextBox Text5
Height = 375
Left = 7560
TabIndex = 10
Text = "Text1"
Top = 4200
Width = 1815
End
Begin VB.TextBox Text4
Height = 375
Left = 7560
TabIndex = 8
Text = "Text1"
Top = 3480
Width = 1815
End
Begin VB.TextBox Text3
Height = 375
Left = 7560
TabIndex = 6
Text = "Text1"
Top = 2760
Width = 1815
End
Begin VB.TextBox Text2
Height = 375
Left = 7560
TabIndex = 4
Text = "Text1"
Top = 2040
Width = 1815
End
Begin VB.TextBox Text1
Height = 375
Left = 7560
TabIndex = 2
Text = "Text1"
Top = 1320
Width = 1815
End
Begin VB.CommandButton Command1
Caption = "显示"
Height = 495
Left = 7560
TabIndex = 1
Top = 6840
Width = 1455
End
Begin MapObjects2.Map Map1
Height = 8175
Left = 0
TabIndex = 0
Top = 120
Width = 6735
_Version = 131072
_ExtentX = 11880
_ExtentY = 14420
_StockProps = 225
BackColor = 16777215
BorderStyle = 1
Contents = "form02.frx":0000
End
Begin VB.Label Label6
Caption = "F"
Height = 375
Left = 7080
TabIndex = 13
Top = 4920
Width = 615
End
Begin VB.Label Label5
Caption = "C"
Height = 375
Left = 7080
TabIndex = 11
Top = 4200
Width = 615
End
Begin VB.Label Label4
Caption = "E"
Height = 375
Left = 7080
TabIndex = 9
Top = 3480
Width = 615
End
Begin VB.Label Label3
Caption = "B"
Height = 375
Left = 7080
TabIndex = 7
Top = 2760
Width = 615
End
Begin VB.Label Label2
Caption = "D"
Height = 375
Left = 7080
TabIndex = 5
Top = 2040
Width = 615
End
Begin VB.Label Label1
Caption = "A"
Height = 375
Left = 7080
TabIndex = 3
Top = 1320
Width = 615
End
Begin ComctlLib.ImageList ImageList1
Left = 2760
Top = 1800
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 16
ImageHeight = 16
MaskColor = 8421376
_Version = 327682
BeginProperty Images {0713E8C2-850A-101B-AFC0-4210102A8DA7}
NumListImages = 3
BeginProperty ListImage1 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = "form02.frx":001A
Key = ""
EndProperty
BeginProperty ListImage2 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = "form02.frx":056C
Key = ""
EndProperty
BeginProperty ListImage3 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = "form02.frx":0ABE
Key = ""
EndProperty
EndProperty
End
End
Attribute VB_Name = "Form02"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'Xuewei,2003/5/28
'使用ImageLayer图层调用一个BMP图像,和MapLayer图层叠加;
'通过改变bmpw文件,来改变图像的位置;
Option Explicit
Dim Ws(6) As Single
Dim dataDir As String
Private Sub DrawLayer()
Dim dc As New DataConnection
Dim mLayer As New MapLayer
dc.Database = dataDir
If Not dc.Connect Then
MsgBox "在指定的文件夹下没找到图层数据文件!"
End
End If
Dim iLayer As New ImageLayer
iLayer.File = dataDir + "\Wash.bmp"
Map1.Layers.Add iLayer
Set mLayer.GeoDataset = dc.FindGeoDataset("roads")
mLayer.Symbol.Color = moYellow
Map1.Layers.Add mLayer
End Sub
Private Sub Command1_Click()
Map1.Layers.Clear
WriteBmpwFile
DrawLayer
End Sub
Private Sub WriteBmpwFile()
Ws(1) = Text1.Text
Ws(2) = Text2.Text
Ws(3) = Text3.Text
Ws(4) = Text4.Text
Ws(5) = Text5.Text
Ws(6) = Text6.Text
Open dataDir + "\Wash.bmpw" For Output As #1
Print #1, Text1.Text
Print #1, Text2.Text
Print #1, Text3.Text
Print #1, Text4.Text
Print #1, Text5.Text
Print #1, Text6.Text
Close #1
End Sub
'找到各子字符串;
Private Sub TrimStr(Str As String)
Dim Str0 As String
Dim Str1 As String
Dim Str2 As String
Dim i As Integer, j As Integer, k As Integer
Dim Sbl As Boolean
Str2 = Str
Str1 = ""
Sbl = False
j = 1
k = 1
For i = 1 To Len(Str)
Str0 = Mid(Str2, 1, 1)
If Asc(Str0) = 32 Or Asc(Str0) = 10 Then
j = j + 1
Else
Str1 = Str1 & Str0
Sbl = True
j = 1
End If
Str2 = Mid(Str2, 2, Len(Str2) - 1)
If j > 1 And Sbl Then
Ws(k) = Str1
Str1 = ""
k = k + 1
Sbl = False
End If
Next i
End Sub
Private Sub ReadBmpwFile()
Dim Str1 As String, Str2 As String
Dim i As Integer
Open dataDir + "\Wash.bmpw" For Input As #1
Str1 = " "
i = 0
Do While Not EOF(1)
Line Input #1, Str2
Str1 = Str1 & Str2 & " "
i = i + 1
Loop
TrimStr Str1
Close #1
Text1.Text = Ws(1)
Text2.Text = Ws(2)
Text3.Text = Ws(3)
Text4.Text = Ws(4)
Text5.Text = Ws(5)
Text6.Text = Ws(6)
End Sub
Private Sub Form_Load()
dataDir = App.Path + "\..\" + "Washington"
ReadBmpwFile
DrawLayer
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -