📄 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 = "{C7FC2F7C-0688-11D5-B2F8-000102D87123}#1.0#0"; "mo21legend.ocx"
Begin VB.Form Form08
Caption = "墨西哥地图浏览系统"
ClientHeight = 7800
ClientLeft = 60
ClientTop = 345
ClientWidth = 10560
LinkTopic = "Form1"
ScaleHeight = 7800
ScaleWidth = 10560
StartUpPosition = 2 '屏幕中心
Begin MO21legend.legend legend1
Height = 4935
Left = 120
TabIndex = 4
Top = 600
Width = 1095
_ExtentX = 1931
_ExtentY = 8705
BackColor = -2147483644
ForeColor = -2147483630
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
End
Begin VB.CommandButton Command1
Caption = "退出"
Height = 375
Left = 120
TabIndex = 3
Top = 6720
Width = 975
End
Begin VB.CommandButton Command3
Caption = "帮助"
Height = 375
Left = 120
TabIndex = 2
Top = 5880
Width = 975
End
Begin MSComctlLib.ImageList ImageList1
Left = 9240
Top = 0
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 20
ImageHeight = 20
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 4
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Form08.frx":0000
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Form08.frx":0112
Key = ""
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Form08.frx":0224
Key = ""
EndProperty
BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Form08.frx":0336
Key = ""
EndProperty
EndProperty
End
Begin MSComctlLib.Toolbar Toolbar1
Align = 1 'Align Top
Height = 480
Left = 0
TabIndex = 1
Top = 0
Width = 10560
_ExtentX = 18627
_ExtentY = 847
ButtonWidth = 714
ButtonHeight = 688
Appearance = 1
ImageList = "ImageList1"
_Version = 393216
BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
NumButtons = 9
BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
Object.ToolTipText = "放大"
ImageIndex = 1
Style = 2
EndProperty
BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
Object.ToolTipText = "缩小"
ImageIndex = 2
Style = 2
EndProperty
BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
Object.ToolTipText = "移动"
ImageIndex = 3
Style = 2
EndProperty
BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628}
Object.ToolTipText = "还原"
ImageIndex = 4
Style = 2
EndProperty
BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628}
EndProperty
BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628}
EndProperty
BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628}
EndProperty
BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628}
EndProperty
BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628}
EndProperty
EndProperty
OLEDropMode = 1
End
Begin MapObjects2.Map Map1
Height = 7095
Left = 1320
TabIndex = 0
Top = 600
Width = 9255
_Version = 131072
_ExtentX = 16325
_ExtentY = 12515
_StockProps = 225
BackColor = 16777215
BorderStyle = 1
Contents = "Form08.frx":0448
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/3
'第2章和第3章的综合例子(MO基本功能设置)
Option Explicit
Dim dc As New DataConnection
Dim layer As MapLayer
Dim r As MapObjects2.Rectangle
Private Sub Command1_Click()
End
End Sub
Private Sub Command3_Click()
Dim Bs As String
Bs = "选择工具栏,可以实现放大、缩小、移动和还原的功能。" & vbCrLf & _
"点击左边的图例控制面板,可以打开和关闭图层。" & vbCrLf & vbCrLf & " Xue Wei,2003/5/3"
MsgBox Bs, , "墨西哥地图浏览系统帮助"
End Sub
Private Sub Map1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Toolbar1.Buttons(1).Value = 1 Then
Set Map1.Extent = Map1.TrackRectangle
ElseIf Toolbar1.Buttons(3).Value = 1 Then
Map1.Pan
ElseIf Toolbar1.Buttons(2).Value = 1 Then
Set r = Map1.Extent
r.ScaleRectangle 1.5
Map1.Extent = r
End If
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
If Toolbar1.Buttons(1).Value = 1 Then
Map1.MousePointer = moZoomIn
ElseIf Toolbar1.Buttons(3).Value = 1 Then
Map1.MousePointer = moPan
ElseIf Toolbar1.Buttons(2).Value = 1 Then
Map1.MousePointer = moZoomOut
ElseIf Toolbar1.Buttons(4).Value = 1 Then
Set Map1.Extent = Map1.FullExtent
Map1.MousePointer = moDefault
End If
End Sub
Private Sub legend1_AfterSetLayerVisible(index As Integer, isVisible As Boolean)
Map1.Refresh
End Sub
Private Sub LayerSet()
Dim Sline As Object
Set layer = New MapLayer
Set layer.GeoDataset = dc.FindGeoDataset("States")
layer.Symbol.Color = moYellow
layer.Symbol.SymbolType = moLineSymbol
layer.Symbol.Size = 1
layer.Symbol.OutlineColor = moBrown
layer.Name = "行政区"
Map1.Layers.Add layer
Set layer = New MapLayer
Set layer.GeoDataset = dc.FindGeoDataset("Lakes")
layer.Symbol.Color = moNavy
layer.Name = "湖泊"
Map1.Layers.Add layer
Set layer = New MapLayer
Set layer.GeoDataset = dc.FindGeoDataset("Roads")
layer.Symbol.Color = moRed
layer.Symbol.Size = 1
layer.Symbol.Style = 0
layer.Name = "公路"
Map1.Layers.Add layer
Set layer = New MapLayer
Set layer.GeoDataset = dc.FindGeoDataset("Rivers")
layer.Symbol.Color = moDarkGreen
layer.Symbol.Size = 2
layer.Name = "河流"
Map1.Layers.Add layer
Set layer = New MapLayer
Set layer.GeoDataset = dc.FindGeoDataset("Cities")
layer.Name = "城市名称"
layer.Symbol.Size = 0
Set layer.Renderer = New LabelRenderer
layer.Renderer.Field = "NAME" '指定要显示的字段
'layer.Renderer.Symbol(0).Font.Name = "幼圆"
'layer.Renderer.Symbol(0).Font.Bold = False '缺省为True
layer.Renderer.Symbol(0).Color = moBlack
layer.Renderer.Symbol(0).Font.Size = 9
layer.Renderer.AllowDuplicates = True
Map1.Layers.Add layer
Set layer = New MapLayer
Set layer.GeoDataset = dc.FindGeoDataset("Cities")
layer.Symbol.Color = moRed
layer.Symbol.Size = 3
layer.Symbol.Style = 0
layer.Name = "城市"
Map1.Layers.Add layer
End Sub
Private Sub Form_Load()
dc.Database = App.Path + "\..\" + "Mexico"
If Not dc.Connect Then
MsgBox "在指定的文件夹下没找到图层数据文件!"
End
End If
LayerSet
legend1.setMapSource Map1
legend1.LoadLegend True
Map1.Refresh
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -