📄 form02.frm
字号:
VERSION 5.00
Object = "{9BD6A640-CE75-11D1-AF04-204C4F4F5020}#2.0#0"; "mo20.ocx"
Begin VB.Form Form02
Caption = "世界地图"
ClientHeight = 4605
ClientLeft = 60
ClientTop = 345
ClientWidth = 5295
LinkTopic = "Form1"
ScaleHeight = 4605
ScaleWidth = 5295
StartUpPosition = 2 '屏幕中心
Begin VB.TextBox Text1
Height = 375
Left = 4200
TabIndex = 4
Text = "Text1"
Top = 4080
Width = 855
End
Begin VB.CommandButton Command2
Caption = "Command2"
Height = 495
Left = 2400
TabIndex = 3
Top = 4080
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "Command1"
Height = 495
Left = 720
TabIndex = 2
Top = 4080
Width = 1335
End
Begin MapObjects2.Map Map1
Height = 3375
Left = 120
TabIndex = 0
Top = 120
Width = 5055
_Version = 131072
_ExtentX = 8916
_ExtentY = 5953
_StockProps = 225
BackColor = 16777215
BorderStyle = 1
Contents = "Form02.frx":0000
End
Begin VB.Label Label1
Caption = "Label1"
Height = 255
Left = 120
TabIndex = 1
Top = 3720
Width = 5055
End
End
Attribute VB_Name = "Form02"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'Xue Wei,2003/6/10
'点击地图ScaleX演示;
Option Explicit
Private Sub Command1_Click()
Me.ScaleMode = Text1
Label1.Caption = "目前单位:" & Me.ScaleMode
End Sub
Private Sub Command2_Click()
Me.ScaleMode = vbTwips
Label1.Caption = "目前单位:" & Me.ScaleMode
End Sub
Private Sub Form_Load()
DrawLayer '加载世界地图中的Country图层;
Text1 = 2
Command1.Caption = "设定单位"
Command2.Caption = "原始单位"
Label1.Caption = "点击地图显示单位。"
End Sub
Private Sub Map1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Label1.Caption = "X坐标:" & Me.ScaleX(X, vbTwips, Me.ScaleMode) & _
" ,Y坐标1:" & Me.ScaleY(Y, vbTwips, Me.ScaleMode) & " ,Y坐标2:" & Me.ScaleX(Y, vbTwips, Me.ScaleMode)
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 = moLimeGreen
Map1.Layers.Add layer
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -