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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值