mapx+vb图元基本操作

前端之家收集整理的这篇文章主要介绍了mapx+vb图元基本操作前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

'1创建图层
Dim lyr As Layer
Set lyr = Map1.Layers.CreateLayer("Car")
Set Map1.Layers.AnimationLayer = lyr '定义为动态图层

'2新建图元
Dim newobj As New MapXLib.Feature 'stand-alone object
Dim obj As MapXLib.Feature 'to hold feature added to layer
Dim NewStyle As New MapXLib.Style
Dim str As String


newobj.Attach Map1

With NewStyle
.SymbolType = miSymbolTypeBitmap
.SymbolBitmapSize = 24
.SymbolBitmapTransparent = True
.SymbolBitmapName = "CAR1-32.BMP"
End With
newobj.Style = NewStyle '设置图元样式

newobj.Type = miFeatureTypeSymbol '设置图元类型

newobj.Point.Set Text1.Text,Text2.Text '设置图元位置

Set obj = Map1.Layers(1).AddFeature(newobj)

obj.Update

'3移动图元
Dim lyr As MapXLib.Layer
Set lyr = Map1.Layers("Car")

Dim ftr As New MapXLib.Feature
Set ftr = lyr.AllFeatures.Item(1)

'ftr.Point.Set 116,40 '重置图元位置
ftr.Offset 1#,1# '移动图元
ftr.Update

'4删除图元
Dim lyr As Layer
Set lyr = Map1.Layers("Car")
lyr.DeleteFeature (lyr.AllFeatures.Item(1))


本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/thomas0yang/archive/2010/09/10/5875494.aspx

原文链接:https://www.f2er.com/vb/261746.html

猜你在找的VB相关文章