我想在WINCC中使用GIS控件MapX,在控件中已添加MapX5.0控件,用VBS控制,但在使用point对象、设置动画图层以及在图层中添加图元时存在问题,请熟悉WINCC VBS的各位高手看看。下面是我的代码。
Sub OnClick(Byval Item) '单击按钮操作MapX
Dim mymap
Set mymap = ScreenItems("控件3")
Dim lyr
Set lyr = mymap.Layers.CreateLayer("temp",,1) ‘建立一个图层
Set mymap.Layers.AnimationLayer = lyr ’将建立的图层设为动画图层
'上面这行出错,提示:Attempt to set the Animation Layer to an object which is not a valid layer object.
Dim pnt
Set pnt = CreateObject("MapX.Point.5")
pnt.set mymap.CenterX,mymap.CenterY
Dim textfeature
Set textfeature = mymap.FeatureFactory.CreateText(pnt,"测试") '建立文本图元
'上面的pnt出错,提示:Invalid Point object.
dim symfea
Set symfea = lyr.addfeature(textfeature) '向图层增加图元
'上面这句出错,提示:Not a feature object or Feature object is no longer valid.
end Sub