📄 form08.frm
字号:
VERSION 5.00
Object = "{9BD6A640-CE75-11D1-AF04-204C4F4F5020}#2.0#0"; "mo20.ocx"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{6C20C089-0689-11D5-B2F8-000102D87123}#2.0#0"; "MO21ScaleBar.ocx"
Begin VB.Form Form08
Caption = "墨西哥地图"
ClientHeight = 5295
ClientLeft = 60
ClientTop = 345
ClientWidth = 8115
LinkTopic = "Form1"
ScaleHeight = 5295
ScaleWidth = 8115
StartUpPosition = 2 '屏幕中心
Begin MO21ScaleBar.ScaleBar sbScaleBar1
Height = 735
Left = 120
TabIndex = 3
Top = 3720
Width = 2055
_ExtentX = 3625
_ExtentY = 1296
BackColor = -2147483633
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ScaleText = 1
ScaleBarUnits = 3
ScreenUnits = 1
End
Begin MSComctlLib.StatusBar StatusBar1
Align = 2 'Align Bottom
Height = 495
Left = 0
TabIndex = 2
Top = 4800
Width = 8115
_ExtentX = 14314
_ExtentY = 873
_Version = 393216
BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628}
NumPanels = 4
BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Object.Width = 3528
MinWidth = 3528
EndProperty
BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Object.Width = 3881
MinWidth = 3881
EndProperty
BeginProperty Panel3 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Object.Width = 3881
MinWidth = 3881
EndProperty
BeginProperty Panel4 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Object.Width = 3528
MinWidth = 3528
EndProperty
EndProperty
End
Begin VB.Frame Frame1
Caption = "Frame1"
Height = 3375
Left = 240
TabIndex = 1
Top = 120
Width = 1695
End
Begin MapObjects2.Map Map1
Height = 4455
Left = 2280
TabIndex = 0
Top = 120
Width = 5775
_Version = 131072
_ExtentX = 10186
_ExtentY = 7858
_StockProps = 225
BackColor = 16777215
BorderStyle = 1
Contents = "Form08.frx":0000
End
End
Attribute VB_Name = "Form08"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'Xue Wei,2003/5/13
'添加ScaleBar控件和StatusBar控件;
Option Explicit
Private Sub refreshScale()
sbScaleBar1.MapExtent.MaxX = Map1.Extent.Right
sbScaleBar1.MapExtent.MinX = Map1.Extent.Left
sbScaleBar1.MapExtent.MaxY = Map1.Extent.Bottom
sbScaleBar1.MapExtent.MinY = Map1.Extent.Top
sbScaleBar1.PageExtent.MinX = Map1.Left / Screen.TwipsPerPixelX
sbScaleBar1.PageExtent.MinY = Map1.Top / Screen.TwipsPerPixelY
sbScaleBar1.PageExtent.MaxX = (Map1.Left + Map1.Width) / Screen.TwipsPerPixelX
sbScaleBar1.PageExtent.MaxY = (Map1.Top + Map1.Height) / Screen.TwipsPerPixelY
sbScaleBar1.Refresh
StatusBar1.Panels(1).text = "比例 1 : " & Format$(sbScaleBar1.RFScale, "###,###,###,###,###")
End Sub
Private Sub Map1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
Dim pt As New MapObjects2.Point
Set pt = Map1.ToMapPoint(x, y)
StatusBar1.Panels(2).text = " x= " & pt.x
StatusBar1.Panels(3).text = " y= " & pt.y
'm_mapTip.MouseMove x, y 'TIPTEXT程序用
End Sub
Private Sub Map2_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
Dim pt As New MapObjects2.Point
Set pt = Map1.ToMapPoint(x, y)
StatusBar1.Panels(2).text = " x= " & pt.x
StatusBar1.Panels(3).text = " y= " & pt.y
End Sub
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)
Call refreshScale
End Sub
Sub DrawLayer()
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
Map1.Layers.Add layer
Map1.Refresh
Set layer = New MapLayer
Set layer.GeoDataset = dc.FindGeoDataset("Cities")
layer.Symbol.Color = moBlue
Map1.Layers.Add layer
End Sub
Private Sub Form_Load()
DrawLayer
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -