Mapwingis开发03(图层数据获取)

本文介绍了一种在地图应用中通过弹窗显示图层属性数据的方法,并提供了一个使用 TextBox 控件来显示图层属性信息的简化示例。

一.弹框显示图层数据

 private ToolStripStatusLabel statusStrip1 = new ToolStripStatusLabel();
        private ToolStripStatusLabel m_label = null;
        public Form1()
        {
   
   
            InitializeComponent();
            ShowAttributes(axMap1, @"", statusStrip1);
        }
        public void ShowAttributes(AxMap axMap1, string dataPath, ToolStripStatusLabel label)
        {
   
   
           axMap1.Projection = tkMapProjection.PROJECTION_WGS84;
            string filename = dataPath + "tantou5.shp";
            Shapefile sf = new Shapefile();
            if (sf.Open(filename))
            {
   
   
                int m_layerHandle = axMap1.AddLayer(sf, true);
                sf = axMap1.get_Shapefile(m_layerHandle);
                //
                if (!sf.Table.StartEditingTable(null))
                {
   
   
                    MessageBox.Show("无法打开编辑模式" + sf.Table.ErrorMsg[sf.LastErrorCode]);
                }
                else
                {
   
   
                    ////提示框
                    //string expression = "";
                    //for (int i = 0; i < sf.NumFields; i++)
                    //{
   
   
                    //    expression += "[" + sf.Field[i].Name + "]";
                    //    if (i != sf.NumFields - 1)
                    //    {
   
   
                    //        const string endLine = "\"\n\"";
                    //        expression += string.Format("+ {0} +", endLine);
                    //    }
                    //}
                    //sf.Labels.Generate(expression, tkLabelPositioning.lpCentroid, false);
                    sf.Labels.TextRenderingHint = tkTextRenderingHint.SystemDefault;
                    axMap1.SendMouseDown = true;
                    axMap1.CursorMode = tkCursorMode.cmIdentify;
                    axMap1.ShapeIdentified += A
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值