日期:2014-05-18  浏览次数:20968 次

添加标注 (mapxtreme2008&C#)
     MapInfo.Data.Table activeMapTable = MapInfo.Engine.Session.Current.Catalog.GetTable("layerName");
                          MapInfo.Mapping.LabelLayer lbLayer = new MapInfo.Mapping.LabelLayer("lbbLayer", "lbbLayer");
                         
                          MapInfo.Mapping.LabelSource lbSource = new MapInfo.Mapping.LabelSource(activeMapTable);
                          //set label\'s style
                          lbSource.DefaultLabelProperties.Style.Font.Name = "宋体";//字体
                          lbSource.DefaultLabelProperties.Style.Font.Size = 9;//大小
                          lbSource.DefaultLabelProperties.Layout.Alignment = MapInfo.Text.Alignment.CenterRight;//标注显示的位置
                          lbSource.DefaultLabelProperties.Layout.Offset = 7;//偏移量
                          lbSource.DefaultLabelProperties.Style.Font.ForeColor = System.Drawing.Color.Black;//标注字颜色 lbSource.DefaultLabelProperties.Style.Font.TextEffect=MapInfo.Styles.TextEffect.Box;//标注背景,Box为方框,Halo为光晕
                          lbSource.DefaultLabelProperties.Style.Font.BackColor = System.Drawing.Color.Yellow;//方框或者光晕的颜色
                          lbSource.DefaultLabelProperties.Style.Font.Shadow = false;//显示阴影
                          lbSource.DefaultLabelProperties.Caption = "xx";//标注字段
                          lbLayer.Sources.Append(lbSource);
                          biaoZhu = lbLayer.Alias;

                          MainMap.Map.Layers.Add(lbLayer);