www.pudn.com > MapX5Demo.rar > frmProperty.frm, change:2002-09-20,size:2957b


VERSION 5.00 
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "msflxgrd.ocx" 
Begin VB.Form frmProperty  
   Caption         =   "要素属性" 
   ClientHeight    =   5565 
   ClientLeft      =   8625 
   ClientTop       =   2850 
   ClientWidth     =   3315 
   LinkTopic       =   "Form1" 
   ScaleHeight     =   5565 
   ScaleWidth      =   3315 
   Begin MSFlexGridLib.MSFlexGrid MSFlexGrid  
      Height          =   5055 
      Left            =   0 
      TabIndex        =   0 
      Top             =   0 
      Width           =   2895 
      _ExtentX        =   5106 
      _ExtentY        =   8916 
      _Version        =   393216 
      FixedCols       =   0 
      BackColorBkg    =   16777215 
   End 
End 
Attribute VB_Name = "frmProperty" 
Attribute VB_GlobalNameSpace = False 
Attribute VB_Creatable = False 
Attribute VB_PredeclaredId = True 
Attribute VB_Exposed = False 
'******************************************************************************** 
'File Name   :frmProperty.frm 
'Description :show features property data used by info query 
'Author      :James Liu 
'Copyright   :MapInfo China 
'Create Date :2002年9月11日 
'******************************************************************************** 
 
Public Sub InitData(sCurEditLayerName As String) 
Dim oLayer As MapXLib.Layer 
Dim oDS As MapXLib.Dataset 
Dim oFtr As MapXLib.Feature 
Dim oFtrs As MapXLib.Features 
Dim bHasFtr As Boolean 
Dim sLayerName As String 
Dim i As Integer 
     
On Error Resume Next 
 
    sLayerName = "" 
    Set oLayer = frmMain.Map.Layers(sCurEditLayerName) 
    If oLayer.Selection.Count > 0 Then 
        Set oFtrs = oLayer.Selection 
        sLayerName = sCurEditLayerName 
    Else 
     
        For Each oLayer In frmMain.Map.Layers 
            If oLayer.Selection.Count > 0 Then 
                Set oFtrs = oLayer.Selection 
                sLayerName = oLayer.Name 
            End If 
        Next oLayer 
    End If 
     
    If sLayerName = "" Then Exit Sub 
     
    Set oFtr = oFtrs(1) 
     
    Set oLayer = frmMain.Map.Layers(sLayerName) 
    Err.Clear 
    Set oDS = frmMain.Map.DataSets(oLayer.Name) 
    If Err.Number > 0 Then 
        Set oDS = frmMain.Map.DataSets.Add(miDataSetLayer, oLayer, oLayer.Name) 
        Err.Clear 
    End If 
    MSFlexGrid.Rows = oDS.Fields.Count + 1 
    MSFlexGrid.Cols = 2 
     
    MSFlexGrid.TextMatrix(0, 0) = "属性名称" 
    MSFlexGrid.TextMatrix(0, 1) = "属性值" 
     
    For i = 1 To oDS.Fields.Count 
        MSFlexGrid.TextMatrix(i, 0) = oDS.Fields(i).Name 
        MSFlexGrid.TextMatrix(i, 1) = oDS.value(oFtr, i) 
    Next i 
     
    Me.Show 0, frmMain 
End Sub 
 
 
Private Sub Form_Resize() 
    MSFlexGrid.Top = 0 
    MSFlexGrid.Left = 0 
    MSFlexGrid.Width = Me.Width 
    MSFlexGrid.Height = Me.Height 
    MSFlexGrid.ColWidth(0) = CLng(MSFlexGrid.Width * 0.57) 
    MSFlexGrid.ColWidth(1) = CLng(MSFlexGrid.Width * 0.37) 
     
     
End Sub