衣
衣雪峰
Unregistered / Unconfirmed
GUEST, unregistred user!
我在图层上添加了一个图元:并且添加了它的ID,NAME,经纬度等信息。
VB的代码是:执行没问题但是如果换成DELPHI7就有问题了(红色的部分)
Dim lyrNew As MapXLib.Layer
Dim ptNew As New MapXLib.Point
Dim ftrNew As MapXLib.Feature
Dim ff As MapXLib.FeatureFactory
Dim li As New MapXLib.LayerInfo
Dim rvs As New MapXLib.RowValues
Dim ds As MapXLib.Dataset
Dim NewStyle As New MapXLib.Style
Dim i As Integer
Set ff = Map1.FeatureFactory
Set lyrNew = Map1.Layers.Item(layname)
Set ds = Map1.Datasets.Add(miDataSetLayer, lyrNew)
Set rvs = ds.RowValues(ds.RowCount)
With NewStyle
.SymbolType = miSymbolTypeBitmap
.SymbolBitmapSize = DrawNum
.SymbolBitmapTransparent = True
.SymbolBitmapName = PictureName
End With
Map1.AutoRedraw = False
lyrNew.Editable = True
[red] rvs.Item(1).value = StationID 就是这里VB执行没问题
rvs.Item(2).value = StationName
rvs.Item(3).value = StationX
rvs.Item(4).value = StationY
rvs.Item(5).value = PlaceID_For_Update
rvs.Item(6).value = RoadID_For_Update[/red]
ptNew.Set StationX, StationY
Set ftrNew = ff.CreateSymbol(ptNew, NewStyle)
Set ftrNew = lyrNew.AddFeature(ftrNew, rvs)
Call ShowLabel
Map1.AutoRedraw = True
lyrNew.Refresh
lyrNew.Editable = False
VB的代码是:执行没问题但是如果换成DELPHI7就有问题了(红色的部分)
Dim lyrNew As MapXLib.Layer
Dim ptNew As New MapXLib.Point
Dim ftrNew As MapXLib.Feature
Dim ff As MapXLib.FeatureFactory
Dim li As New MapXLib.LayerInfo
Dim rvs As New MapXLib.RowValues
Dim ds As MapXLib.Dataset
Dim NewStyle As New MapXLib.Style
Dim i As Integer
Set ff = Map1.FeatureFactory
Set lyrNew = Map1.Layers.Item(layname)
Set ds = Map1.Datasets.Add(miDataSetLayer, lyrNew)
Set rvs = ds.RowValues(ds.RowCount)
With NewStyle
.SymbolType = miSymbolTypeBitmap
.SymbolBitmapSize = DrawNum
.SymbolBitmapTransparent = True
.SymbolBitmapName = PictureName
End With
Map1.AutoRedraw = False
lyrNew.Editable = True
[red] rvs.Item(1).value = StationID 就是这里VB执行没问题
rvs.Item(2).value = StationName
rvs.Item(3).value = StationX
rvs.Item(4).value = StationY
rvs.Item(5).value = PlaceID_For_Update
rvs.Item(6).value = RoadID_For_Update[/red]
ptNew.Set StationX, StationY
Set ftrNew = ff.CreateSymbol(ptNew, NewStyle)
Set ftrNew = lyrNew.AddFeature(ftrNew, rvs)
Call ShowLabel
Map1.AutoRedraw = True
lyrNew.Refresh
lyrNew.Editable = False