📄 identify.frm
字号:
VERSION 5.00
Object = "{9BD6A640-CE75-11D1-AF04-204C4F4F5020}#2.0#0"; "Mo20.ocx"
Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "comctl32.ocx"
Begin VB.Form Form1
Caption = "Identify Sample"
ClientHeight = 3330
ClientLeft = 1095
ClientTop = 1515
ClientWidth = 8160
LinkTopic = "Form1"
PaletteMode = 1 'UseZOrder
ScaleHeight = 3330
ScaleWidth = 8160
Begin ComctlLib.ListView ListView1
Height = 3135
Left = 5040
TabIndex = 0
Top = 120
Width = 3015
_ExtentX = 5318
_ExtentY = 5530
View = 3
LabelWrap = -1 'True
HideSelection = -1 'True
_Version = 327682
ForeColor = -2147483640
BackColor = -2147483643
Appearance = 1
NumItems = 0
End
Begin MapObjects2.Map Map1
Height = 3135
Left = 120
TabIndex = 1
Top = 120
Width = 4815
_Version = 131072
_ExtentX = 8493
_ExtentY = 5530
_StockProps = 225
BackColor = 16711680
BorderStyle = 1
BackColor = 16711680
Contents = "Identify.frx":0000
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'The Identify sample program illustrates feature identification using the
'SearchShape method and the moPointInPolygon SearchMethodConstant to locate
'a feature and a ListView control to display the results. This ListView
'control is populated with Field names and values obtained from the
'ValueAsString method. This sample uses the World countries sample dataset.
Private Sub Form_Load()
' initialize the listview columns
Set Col = ListView1.ColumnHeaders.Add()
Col.Text = "Field"
Set Col = ListView1.ColumnHeaders.Add()
Col.Text = "Value"
' load data into the map
Dim dc As New DataConnection
dc.Database = "D:\周玉科\country\可用"
If Not dc.Connect Then End
Dim layer As MapLayer
Set layer = New MapLayer
Set layer.GeoDataset = dc.FindGeoDataset("polygon_Proj.shp")
layer.Symbol.Color = 4636724
Map1.Layers.Add layer
End Sub
Private Sub Map1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
' get the layer
Set l = Map1.Layers("polygon_Proj.shp")
' transform the point to map coordinates
Set p = Map1.ToMapPoint(x, y)
' perform the search
Set recs = l.SearchShape(p, moPointInPolygon, "")
' if the search returned something, display the fields
' and values
If Not recs.EOF Then
' clear out existing info
ListView1.ListItems.Clear
For Each fld In recs.Fields ' iterate over the fields
Set newItem = ListView1.ListItems.Add
newItem.Text = fld.Name
newItem.SubItems(1) = fld.ValueAsString ' get the value
Next fld
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -