zoukankan      html  css  js  c++  java
  • ae_datagridview显示属性

    public partial class FrmAttributeTable : Form
        {
            private AxMapControl m_MapCtl;
            public FrmAttributeTable(AxMapControl pMapCtl)
            {
                InitializeComponent();
                m_MapCtl = pMapCtl;
            }
    
            private void FrmAttributeTable_Load(object sender, EventArgs e)
            {
                ILayer pLayer = m_MapCtl.get_Layer(0);
                IFeatureLayer pFLayer = pLayer as IFeatureLayer;
                IFeatureClass pFC = pFLayer.FeatureClass;
    
                IFeatureCursor pFCursor = pFC.Search(null, false);
                IFeature pFeature = pFCursor.NextFeature();
    
                DataTable pTable = new DataTable();
    
                DataColumn colName = new DataColumn("ID");
                colName.DataType = System.Type.GetType("System.String");
                pTable.Columns.Add(colName);
    
                DataColumn pBSM = new DataColumn("BSM");
                pBSM.DataType = System.Type.GetType("System.String");
                pTable.Columns.Add(pBSM);
    
                DataColumn colArea = new DataColumn("TBMJ");
                colArea.DataType = System.Type.GetType("System.String");
                pTable.Columns.Add(colArea);
    
                int indexOfID = pFC.FindField("ID");
                int indexOfBSM = pFC.FindField("BSM");
                int indexOfTBMJ = pFC.FindField("TBMJ");
    
                while (pFeature != null)
                {
                    string id = pFeature.get_Value(indexOfID).ToString();
                    string bsm = pFeature.get_Value(indexOfBSM).ToString();
                    string TBMJ = pFeature.get_Value(indexOfTBMJ).ToString();
                    DataRow pRow = pTable.NewRow();
                    pRow[0] = id;
                    pRow[1] = bsm;
                    pRow[2] = TBMJ;
                    pTable.Rows.Add(pRow);
                    pFeature = pFCursor.NextFeature();
                }
                dataGridView1.DataSource = pTable;
            }
        }
    
  • 相关阅读:
    跳转指定页面
    如何解决项目中.a文件中的.o冲突
    地图根据起点和终点计算中心点角度来绘制弧线 iOS
    codePush常用
    ios原生push到RN界面后pop
    atomic,nonatomic的区别
    KVC
    jQuery绑定event事件的各种方法比较
    Git常用命令总结
    多个$(document).ready()的执行顺序问题
  • 原文地址:https://www.cnblogs.com/xianerwonder/p/4239320.html
Copyright © 2011-2022 走看看