博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
superMap Object 属性查看的一点代码
阅读量:5015 次
发布时间:2019-06-12

本文共 4498 字,大约阅读时间需要 14 分钟。

using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using HZZYKJ.IDRMIS.CORE;using SuperMap.Mapping;using SuperMap.UI;using SuperMap.Data;using HZZYKJ.IDRMIS.EDIM.Tools;using HZZYKJ.IDRMIS.EDIM.toolClass;namespace HZZYKJ.IDRMIS.EDIM{    public partial class AttributeTreeForm : Form    {        private MapControl mapControl;        private List
layers = new List
(); public static AttributeTreeForm _AttributeTreeForm = null; public AttributeTreeForm() { InitializeComponent(); mapControl = AppContext.MapControl as MapControl; } private void AttributeTreeForm_Load(object sender, EventArgs e) { Layers layers = mapControl.Map.Layers; foreach (Layer item in layers) { this.layers.Add(item); } Layer layer = this.layers[LayerForm._layerform.comboBox1.SelectedIndex]; Selection selection = layer.Selection; Recordset recordset = selection.ToRecordset(); TreeNode TN_Layer_Father = new TreeNode(layer.Name); treeView1.Nodes.Add(TN_Layer_Father); for (int i = 0; i < recordset.RecordCount; i++) { string name = recordset.GetFieldValue(0).ToString(); TreeNode TN_Fild_Child = new TreeNode(name); TN_Layer_Father.Nodes.Add(TN_Fild_Child); recordset.MoveNext(); } this.treeView1.SelectedNode = this.treeView1.Nodes[0].Nodes[0]; treeView1.ExpandAll(); } private void AttributeTreeForm_FormClosed(object sender, FormClosedEventArgs e) { _AttributeTreeForm = null; } private void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) { } private void treeView1_AfterSelect(object sender, TreeViewEventArgs e) { BindingList
GridBindingList = new BindingList
(); // List
GridList = new List
(); if (this.treeView1.SelectedNode.Parent != null) { Layers layers = mapControl.Map.Layers; foreach (Layer item in layers) { this.layers.Add(item); } Layer layer = this.layers[LayerForm._layerform.comboBox1.SelectedIndex]; Selection selection = layer.Selection; Recordset recordset = selection.ToRecordset(); FieldInfos fieldinfos = recordset.GetFieldInfos(); for (int i = 0; i < recordset.RecordCount; i++) { if (this.treeView1.SelectedNode.Text == recordset.GetFieldValue(0).ToString()) { for (int j = 0; j < recordset.FieldCount; j++) { if (this.checkBox1.Checked == false) { string x = fieldinfos[j].Name; string y = null; if (recordset.GetFieldValue(j).ToString() == null) { y = null; } else { y = recordset.GetFieldValue(j).ToString();//总是出错 } FieldInfoName FIN = new FieldInfoName(x, y); GridBindingList.Add(FIN); } else { if (fieldinfos[j].IsSystemField == false) { string x = fieldinfos[j].Name; string y = recordset.GetFieldValue(j).ToString(); FieldInfoName FIN = new FieldInfoName(x, y); GridBindingList.Add(FIN); } } } } recordset.MoveNext(); } this.dataGridView1.DataSource = GridBindingList; } else { MessageBox.Show("请选择子节点"); } } private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e) { } private void btn_Ok_Click(object sender, EventArgs e) { Layers layers = mapControl.Map.Layers; foreach (Layer item in layers) { this.layers.Add(item); } Layer layer = this.layers[LayerForm._layerform.comboBox1.SelectedIndex]; Selection selection = layer.Selection; Recordset recordset = selection.ToRecordset(); FieldInfos fieldinfos = recordset.GetFieldInfos(); for (int i = 0; i < recordset.RecordCount; i++) { if (this.treeView1.SelectedNode.Text == recordset.GetFieldValue(0).ToString()) { for (int j = 0; j < recordset.FieldCount; j++) { if (fieldinfos[j].IsSystemField == false) { recordset.Edit(); string a = this.dataGridView1.Rows[j].Cells[1].Value.ToString(); recordset.SetFieldValue(j, a); recordset.Update(); } } } recordset.MoveNext(); } MessageBox.Show("属性值修改成功"); } private void checkBox1_CheckedChanged(object sender, EventArgs e) { } }}

 

转载于:https://www.cnblogs.com/sjfsjf/p/3880624.html

你可能感兴趣的文章
修改远程桌面端口号(默认3389)
查看>>
推荐四款在线富文本编辑器
查看>>
05-树8 File Transfer
查看>>
xe mysql
查看>>
Beta冲刺 第四天
查看>>
【iOS】self与block的使用规范
查看>>
【ABAP系列】SAP ABAP POPUP_TO_CONFIRM 弹出框总结
查看>>
非常全的linux面试笔试题及答案
查看>>
将DataTable转换List 集合
查看>>
Mac软件推荐
查看>>
微信小程序 | app.json配置属性
查看>>
日志记录帮助类
查看>>
Datatables js 复杂表头 合并单元格
查看>>
Django——model(建表,增删改查,外键,多对多)
查看>>
HDU 5881 Tea -2016 ICPC 青岛赛区网络赛
查看>>
shell 编程之函数
查看>>
Microsoft Jet 数据库引擎 SQL 和 ANSI SQL 的比较
查看>>
int -2147483648 ----- 2147483647
查看>>
博客作业05--查找
查看>>
ios 涉及到支付金额计算的相关总结
查看>>