📄 form01.frm
字号:
VERSION 5.00
Object = "{9BD6A640-CE75-11D1-AF04-204C4F4F5020}#2.0#0"; "mo20.ocx"
Begin VB.Form Form01
Caption = "墨西哥地图"
ClientHeight = 5700
ClientLeft = 60
ClientTop = 345
ClientWidth = 7710
LinkTopic = "Form1"
ScaleHeight = 5700
ScaleWidth = 7710
StartUpPosition = 2 '屏幕中心
Begin MapObjects2.Map Map1
Height = 5415
Left = 120
TabIndex = 0
Top = 120
Width = 7455
_Version = 131072
_ExtentX = 13150
_ExtentY = 9551
_StockProps = 225
BackColor = 16777215
BorderStyle = 1
Contents = "Form01.frx":0000
End
End
Attribute VB_Name = "Form01"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'Xue Wei,2003/5/17
'SearchExpression的简单练习;
Option Explicit
Dim g_symSelection As MapObjects2.Symbol
Dim recSelection As MapObjects2.Recordset
Private Sub Form_Load()
Dim strExpression As String
DrawLayer
'查找
'strExpression = "STATE_ID > 24 AND STATE_ID < 27"
strExpression = "STATE_ID = 24"
Set recSelection = Map1.Layers(0).SearchExpression(strExpression)
'设置显示模式
Set g_symSelection = New MapObjects2.Symbol
g_symSelection.SymbolType = Map1.Layers(0).Symbol.SymbolType
g_symSelection.color = moDarkGreen
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
Map1.Refresh
End Sub
Private Sub Map1_AfterLayerDraw(ByVal index As Integer, ByVal canceled As Boolean, ByVal hDC As stdole.OLE_HANDLE)
Map1.DrawShape recSelection, g_symSelection
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -