📄 form06.frm
字号:
VERSION 5.00
Object = "{9BD6A640-CE75-11D1-AF04-204C4F4F5020}#2.0#0"; "mo20.ocx"
Begin VB.Form Form06
Caption = "世界地图"
ClientHeight = 4590
ClientLeft = 60
ClientTop = 345
ClientWidth = 7260
LinkTopic = "Form1"
ScaleHeight = 4590
ScaleWidth = 7260
StartUpPosition = 2 '屏幕中心
Begin MapObjects2.Map Map1
Height = 3735
Left = 0
TabIndex = 0
Top = 120
Width = 7215
_Version = 131072
_ExtentX = 12726
_ExtentY = 6588
_StockProps = 225
BackColor = 16777215
BorderStyle = 1
Contents = "Form06.frx":0000
End
Begin VB.Label Label1
Caption = "Label1"
Height = 255
Left = 1800
TabIndex = 1
Top = 4080
Width = 4215
End
End
Attribute VB_Name = "Form06"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'Xuewei,2003/6/10
'ToMapDistance和ToMapPoint练习;
'在世界地图上显示点击处坐标(公里);
Option Explicit
Dim Dx As Single
Private Sub Form_Load()
Dx = 40075.7 / 360
Label1.Caption = "点击地图显示公里。"
DrawLayer '加载世界地图;
End Sub
Private Sub Map1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim Str1 As String
Str1 = "x=" & Format(Map1.ToMapDistance(X) * Dx, "0.000") & ",y=" & Format(Map1.ToMapDistance(Y) * Dx, "0.000")
Label1.Caption = Str1
End Sub
Sub DrawLayer()
Dim dc As New DataConnection
Dim layer As MapLayer
dc.Database = App.Path + "\..\" + "world"
If Not dc.Connect Then
MsgBox "在指定的文件夹下没找到图层数据文件!"
End
End If
Set layer = New MapLayer
Set layer.GeoDataset = dc.FindGeoDataset("country")
layer.Symbol.Color = moRed
Map1.Layers.Add layer
Set layer = New MapLayer
Set layer.GeoDataset = dc.FindGeoDataset("latlon")
layer.Symbol.Color = moDarkGreen
Map1.Layers.Add layer
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -