/// <summary> /// 初始化 /// </summary> /// <param name="mapid"></param> /// <param name="layerid"></param> /// <param name="objectid"></param> public void Initial(decimal mapid, decimal layerid, decimal objectid) { _MapId = mapid; _LayerId = layerid; _ObjectId = objectid; _datatable = MapDBClass.GetSalePrice(mapid, layerid, objectid); for (int i = _datatable.Columns.Count - 1; i >= 0; i--) { bool find = false; for (int j = 0; j < dataGridView1.ColumnCount; j++) { if (dataGridView1.Columns[j].DataPropertyName == _datatable.Columns[i].ColumnName) { find = true; break; } } if (!find) { _datatable.Columns.RemoveAt(i); } } SetData(_datatable); }