📄 form01.frm
字号:
VERSION 5.00
Object = "{9BD6A640-CE75-11D1-AF04-204C4F4F5020}#2.0#0"; "mo20.ocx"
Begin VB.Form Form01
Caption = "墨西哥地图"
ClientHeight = 5460
ClientLeft = 60
ClientTop = 345
ClientWidth = 7590
LinkTopic = "Form1"
ScaleHeight = 5460
ScaleWidth = 7590
StartUpPosition = 2 '屏幕中心
Begin MapObjects2.Map Map2
Height = 1215
Left = 120
TabIndex = 2
Top = 4080
Width = 1455
_Version = 131072
_ExtentX = 2566
_ExtentY = 2143
_StockProps = 225
BackColor = 16777215
BorderStyle = 1
Contents = "Form01.frx":0000
End
Begin VB.Frame Frame1
Caption = "Frame1"
Height = 3615
Left = 240
TabIndex = 1
Top = 120
Width = 1095
End
Begin MapObjects2.Map Map1
Height = 5175
Left = 1680
TabIndex = 0
Top = 120
Width = 5775
_Version = 131072
_ExtentX = 10186
_ExtentY = 9128
_StockProps = 225
BackColor = 16777215
BorderStyle = 1
Contents = "Form01.frx":001A
End
End
Attribute VB_Name = "Form01"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'Xue Wei,2003/5/10
'添加指示窗口
Option Explicit
Private Sub Map1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
Set Map1.Extent = Map1.TrackRectangle
ElseIf Button = vbRightButton Then
Map1.Pan
End If
End Sub
Private Sub Map1_AfterLayerDraw(ByVal index As Integer, ByVal canceled As Boolean, ByVal hDC As StdOle.OLE_HANDLE)
If index = 0 Then
Map2.TrackingLayer.Refresh True
End If
End Sub
Private Sub Map2_AfterTrackingLayerDraw(ByVal hDC As StdOle.OLE_HANDLE)
Dim sym As New Symbol
sym.OutlineColor = moRed
sym.Style = moTransparentFill
Map2.DrawShape Map1.Extent, sym
End Sub
Private Sub Form_Load()
Dim dc As New DataConnection
Dim layer As MapLayer
dc.Database = App.Path + "\..\" + "Mexico"
If Not dc.Connect Then
MsgBox "在指定的文件夹下没找到图层数据文件!"
End
End If
Set layer = New MapLayer
Set layer.GeoDataset = dc.FindGeoDataset("States")
layer.Symbol.Color = moYellow
Map1.Layers.Add layer
Set layer = New MapLayer
Set layer.GeoDataset = dc.FindGeoDataset("Rivers")
layer.Symbol.Color = moRed
'layer.Symbol.Style = 1
Map1.Layers.Add layer
Map1.Refresh
Set layer = New MapLayer
Set layer.GeoDataset = dc.FindGeoDataset("states")
layer.Symbol.Color = moPaleYellow
Map2.Layers.Add layer
Map2.Refresh
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -