📄 form06a.frm
字号:
VERSION 5.00
Object = "{9BD6A640-CE75-11D1-AF04-204C4F4F5020}#2.0#0"; "mo20.ocx"
Begin VB.Form Form06a
Caption = "墨西哥地图"
ClientHeight = 5445
ClientLeft = 60
ClientTop = 345
ClientWidth = 6765
LinkTopic = "Form1"
ScaleHeight = 5445
ScaleWidth = 6765
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Command1
Caption = "显示"
Height = 495
Left = 2640
TabIndex = 1
Top = 4800
Width = 1335
End
Begin MapObjects2.Map Map1
Height = 4575
Left = 0
TabIndex = 0
Top = 0
Width = 6735
_Version = 131072
_ExtentX = 11880
_ExtentY = 8070
_StockProps = 225
BackColor = 16777215
BorderStyle = 1
Contents = "Form06a.frx":0000
End
End
Attribute VB_Name = "Form06a"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'Xuewei,2003/6/7
'ClassBreaksRenderer示例;
'SizeSymbols
Option Explicit
Private Sub Command1_Click()
Dim i As Integer
Dim oMapLayer As MapObjects2.MapLayer
Dim oStats As MapObjects2.Statistics
Dim oClassRend As New MapObjects2.ClassBreaksRenderer
Dim fBreakVal As Double
Set oMapLayer = Map1.Layers("cities")
Set oMapLayer.Renderer = oClassRend
With oClassRend
.SymbolType = moPointSymbol
.Field = "POPULATION"
Set oStats = oMapLayer.Records.CalculateStatistics("POPULATION")
fBreakVal = oStats.Mean - (oStats.StdDev * 3)
For i = 0 To 6
If fBreakVal >= oStats.Min And fBreakVal <= oStats.Max Then
.BreakCount = .BreakCount + 1
.Break(.BreakCount - 1) = fBreakVal
End If
fBreakVal = fBreakVal + oStats.StdDev
Next
.SizeSymbols 3, 8
' For i = 0 To .BreakCount
' .Symbol(i).Color = moRed
' Next
.RampColors moLimeGreen, moRed
End With
Map1.Refresh
End Sub
Private Sub Form_Load()
DrawLayer '添加States和Cities图层;
End Sub
Private 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 = moPaleYellow
layer.Symbol.Size = 1
layer.Symbol.OutlineColor = moBrown
Map1.Layers.Add layer
Set layer = New MapLayer
Set layer.GeoDataset = dc.FindGeoDataset("Cities")
layer.Symbol.Color = moRed
layer.Symbol.Size = 3
Map1.Layers.Add layer
Map1.Refresh
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -