📄 frmidentify.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "msflxgrd.ocx"
Begin VB.Form frmIdentify
BorderStyle = 3 'Fixed Dialog
Caption = "查看结果"
ClientHeight = 3480
ClientLeft = 45
ClientTop = 330
ClientWidth = 6930
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3480
ScaleWidth = 6930
ShowInTaskbar = 0 'False
StartUpPosition = 2 'CenterScreen
Begin MSFlexGridLib.MSFlexGrid MSFlexGrid
Height = 2415
Left = 2450
TabIndex = 4
Top = 1000
Width = 4455
_ExtentX = 7858
_ExtentY = 4260
_Version = 393216
Rows = 19
Cols = 9
FixedCols = 0
BackColor = 16777215
GridColor = 16777215
AllowUserResizing= 1
Appearance = 0
End
Begin VB.TextBox TextCor
Appearance = 0 'Flat
BackColor = &H80000003&
Enabled = 0 'False
Height = 350
Left = 2520
TabIndex = 3
Top = 600
Width = 4335
End
Begin MSComctlLib.TreeView TreeView
Height = 2895
Left = 0
TabIndex = 2
Top = 600
Width = 2415
_ExtentX = 4260
_ExtentY = 5106
_Version = 393217
Indentation = 353
LabelEdit = 1
LineStyle = 1
Style = 7
BorderStyle = 1
Appearance = 0
End
Begin VB.ComboBox ComboLayer
Height = 315
Left = 960
TabIndex = 0
Top = 120
Width = 3855
End
Begin VB.Label Label1
Caption = "图层:"
Height = 255
Left = 120
TabIndex = 1
Top = 120
Width = 735
End
End
Attribute VB_Name = "frmIdentify"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private m_hwndTV As Long
Public Sub InitTreeView()
Dim i As Long, j As Long
Dim check As Boolean
On Error Resume Next
TreeView.Nodes.Clear
For i = 0 To UBound(M_pFeatureArray) - 1
check = False
For j = 0 To ComboLayer.ListCount
If M_pFeatureArray(i).iLayerName = ComboLayer.List(j) Then
check = True
Exit For
End If
Next j
If check = False Then
ComboLayer.AddItem M_pFeatureArray(i).iLayerName
End If
Next i
''''''''''''''''''''''''''''''''''''''''''''''''''''''
MSFlexGrid.Cols = 2
MSFlexGrid.ColAlignment(1) = flexAlignLeftCenter
MSFlexGrid.TextMatrix(0, 0) = "字段"
MSFlexGrid.ColWidth(0) = 1600
MSFlexGrid.ColWidth(1) = 2500
MSFlexGrid.TextMatrix(0, 1) = "值"
If UBound(M_pFeatureArray) = 0 Then Exit Sub
Dim Node1 As Node
Dim Node2 As Node
ComboLayer.Text = ComboLayer.List(0)
For i = 0 To ComboLayer.ListCount - 1
Set Node1 = TreeView.Nodes.Add(, , , ComboLayer.List(i))
For j = 0 To UBound(M_pFeatureArray) - 1
If M_pFeatureArray(j).iLayerName = ComboLayer.List(i) Then
Set Node2 = TreeView.Nodes.Add(Node1.Index, tvwChild, , CStr(M_pFeatureArray(j).iFeature.Value(0)))
End If
Next
If i = 0 Then
Node1.Expanded = True
End If
Next i
'''''''''''''''''''''''''''''''''''''''''''''''''''''''
MSFlexGrid.Rows = M_pFeatureArray(0).iFeature.Fields.FieldCount + 10
For i = 0 To M_pFeatureArray(0).iFeature.Fields.FieldCount - 1
MSFlexGrid.TextMatrix(i + 1, 0) = M_pFeatureArray(0).iFeature.Fields.Field(i).AliasName
If M_pFeatureArray(0).iFeature.Fields.Field(i).Type = 7 Then
MSFlexGrid.TextMatrix(i + 1, 1) = ReturnGeometryName(M_pFeatureArray(0).iFeature.Shape.GeometryType)
Else
MSFlexGrid.TextMatrix(i + 1, 1) = CStr(M_pFeatureArray(0).iFeature.Value(i)) + ""
End If
Next i
Dim strXY As String
strXY = CStr(M_pFeatureArray(0).iFeature.Extent.XMin) + " " + CStr(M_pFeatureArray(0).iFeature.Extent.YMin)
TextCor.Text = "位置: (" + strXY + ")"
Dim pobjGeometry As IGeometry
Set pobjGeometry = M_pFeatureArray(0).iFeature.Shape
frmMDIMap.MapControl.FlashShape pobjGeometry
' Show the nodes that are checked.
End Sub
Private Sub Form_Load()
'Call InitTreeView
End Sub
Private Sub Form_Unload(Cancel As Integer)
ReDim M_pFeatureArray(0)
End Sub
Private Sub TreeView_NodeClick(ByVal Node As MSComctlLib.Node)
Dim i As Long
Dim j As Long
Dim iLayerName As String
Dim ObjName As String
On Error Resume Next
If Not Node.Parent Is Nothing Then
iLayerName = Node.Parent.Text
ObjName = Node.Text
For i = 0 To UBound(M_pFeatureArray) - 1
If iLayerName = M_pFeatureArray(i).iLayerName And ObjName = CStr(M_pFeatureArray(i).iFeature.Value(0)) Then
MSFlexGrid.Clear
MSFlexGrid.Cols = 2
MSFlexGrid.ColAlignment(1) = flexAlignLeftCenter
MSFlexGrid.TextMatrix(0, 0) = "字段"
MSFlexGrid.ColWidth(0) = 1600
MSFlexGrid.ColWidth(1) = 2500
MSFlexGrid.TextMatrix(0, 1) = "值"
MSFlexGrid.Rows = M_pFeatureArray(i).iFeature.Fields.FieldCount + 10
For j = 0 To M_pFeatureArray(i).iFeature.Fields.FieldCount - 1
MSFlexGrid.TextMatrix(j + 1, 0) = M_pFeatureArray(i).iFeature.Fields.Field(j).AliasName
If M_pFeatureArray(i).iFeature.Fields.Field(j).Type = 7 Then
MSFlexGrid.TextMatrix(j + 1, 1) = ReturnGeometryName(M_pFeatureArray(i).iFeature.Shape.GeometryType)
Else
MSFlexGrid.TextMatrix(j + 1, 1) = M_pFeatureArray(i).iFeature.Value(j)
End If
Next j
Dim pobjGeometry As IGeometry
Set pobjGeometry = M_pFeatureArray(i).iFeature.Shape
' frmMDIMap.MapControl.FlashShape pobjGeometry
Call FlashFeature(M_pFeatureArray(i).iFeature, frmMDIMap.MapControl.ActiveView.FocusMap)
MSFlexGrid.TopRow = 1
Dim strXY As String
strXY = CStr(M_pFeatureArray(i).iFeature.Extent.XMin) + " " + CStr(M_pFeatureArray(i).iFeature.Extent.YMin)
TextCor.Text = "位置: (" + strXY + ")"
Exit For
End If
Next i
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -