当前位置:软件学习 > 其它软件 >>

MapXtreme 2005中怎样添加文本标注

大家好,
    我想在自己添加的图元上面添加标注,但是发现mapxtreme6.6没有annotation项,而且也不知道怎样修改定义自定义图元的toollip提示文字,望各位专家指教,最好给出实例,谢谢!
--------------------编程问答-------------------- 参考开发指南吧,MapXtreme2005中,是这样的:

  1.new 一个labellayer图层, 并将图层add 到map的layers集合中。

  2.将标注图层的.source 属性绑定到要标注的图元所属table中,

  3.设置 lableproperties ,包括字体、标题表达式、覆盖等。。。。

 done :)

  --------------------编程问答-------------------- 谢谢回复,能否给我一个实例,我试用一下代码添加了一个label图层
            MapInfo.Mapping.LabelSource ls = new LabelSource(fl.Table);
            
            //Append the LabelSource to the LabelLayer's Sources
            MapInfo.Mapping.LabelLayer ll = new LabelLayer("temp") ;
            
            ll.Sources.Append(ls);
            mapControl1.Map.Layers.Add(ll);

但是不知道怎样修改label属性,比如文字、大小、位置等,望指教,谢谢! --------------------编程问答-------------------- 对于一个自定义的图元,怎样才可以更改其TOOLTIP属性值?
--------------------编程问答--------------------             //自动标注
            LabelLayer layer = new LabelLayer(m_VehLayerName + " label");
            MapMain.Map.Layers.Add(layer);
            LabelSource source = new LabelSource(tblTemp);
            source.DefaultLabelProperties.Caption = "ShowNote"; //标注时用到的字段
            source.DefaultLabelProperties.Style.Font.ForeColor = System.Drawing.Color.Black;//字体颜色
            source.DefaultLabelProperties.Style.Font.BackColor = System.Drawing.Color.Transparent; //字体背景
            source.DefaultLabelProperties.Style.Font.Name = this.Font.Name;  //字体名称
            source.DefaultLabelProperties.Style.Font.Size = this.Font.Size; //字体大小
            source.DefaultLabelProperties.Style.Font.TextEffect = MapInfo.Styles.TextEffect.Box;   //边缘效果 Box为方框,Halo为光晕
            source.DefaultLabelProperties.Style.Font.FontWeight = MapInfo.Styles.FontWeight.Bold;  //粗体
            source.DefaultLabelProperties.Style.Font.Shadow = false;//显示阴影
            source.DefaultLabelProperties.Layout.Alignment = MapInfo.Text.Alignment.BottomCenter;   //相对位置
            source.DefaultLabelProperties.Layout.Offset = 15; //标注偏移度
            source.Enabled = true; //标注是否显示 --------------------编程问答-------------------- 我也想知道这个问题,上面两位的代码我有点不懂的地方,哪句代码是指定被标注图元的呢? --------------------编程问答-------------------- 我明白了,原来是鼠标放上去程序自动会去取出DefaultLabelProperties.Caption指定的字段作为标注的值
补充:企业软件 ,  地理信息系统
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,