如何在MapX 下读取属性值 有三种方法: 1. 由Layer 对象的KeyField 属性来设立要读取属性值的字段名。 接着,由Feature 对象的keyValue 读取此行的属性值。 2. 将图层加入到Datasets, 由Dataset 对象的Value(x,y)属性,通过设置行号,列号来获得属性值。 3. 将图层加入到Datasets,之后由RowValues(ftr)获取整行的值。 Dim ds As MapXLib.Dataset, lyr As MapXLib.layer Dim ftrs As Features Dim ftr As Feature Dim rv As RowValue Dim rvs As RowValues Dim DsName As String ‘数据集名 Dim DsRows As Long, DsCols As Long Dim i As Long, j As Long Set ds = Formmain.Map1.Datasets.Item(DsName) Set lyr = ds.layer Set ftrs = lyr.AllFeatures DsCols = ds.Fields.Count DsCols = DsCols + 1 DsRows = ftrs.Count Grid1.Rows = DsRows + 1 Grid1.Cols = DsCols Grid1.Row = 0 For i = 0 To DsCols - 1 Grid1.Col = i Grid1.Text = ds.Fields.Item(i + 1).Name Next i Grid1.Col = DsCols - 1 Grid1.Text = "Fkey" lyr.BeginAccess miAccessRead i = 1 For Each ftr In ftrs Set rvs = ds.RowValues(ftr) j = 0 For Each rv In rvs If Not IsNull(rv.Value) Then Grid1.TextArray(i * DsCols + j) = Trim(rv.Value) j = j + 1 Next Grid1.TextArray(i * DsCols + j) = ftr.FeatureKey i = i + 1 Next lyr.EndAccess miAccessEnd Set ftr = Nothing Set ftrs = Nothing Set ds = Nothing Set rv = Nothing Set rvs = Nothing Set lyr = Nothing 注意:BeginAccess,以及EndAccess 可以明显的提高属性读取的速度。回页首 自定义范围专题图 mapx 的专题图用户可以进行完全的定制,下面是自定义范围专题图的例子。 Dim ds As New MapXLib.Dataset Dim thm As New MapXLib.Theme Set ds = Formmain.Map1.Datasets(ToolBars.Combo2.Text) Set thm = ds.Themes.add(0, "aa", "aa", False) thm.Legend.Compact = False thm.AutoRecompute = False 'thm.ComputeTheme = False thm.DataMax = 700 thm.DataMin = 100 thm.ThemeProperties.AllowEmptyRanges = True thm.ThemeProperties.Num...