Code for viewing the Supermap object attribute

Source: Internet
Author: User
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: fo RM {private mapcontrol; private list <layer> layers = new list <layer> (); public static attributetreeform _ attributetreeform = NULL; Public attributetreeform () {initializecomponent (); mapcontrol = appcontext. mapcontrol as mapcontrol;} private void attributetreeform_load (Object sender, eventargs e) {layers = mapcontrol. map. layers; foreach (layer item in layers) {This. layers. add (Item);} layer Layer = This. layers [layerform. _ layerform. combobox1.selectedindex]; selection = layer. selection; 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 evaluate (Object sender, inclue) {_ attributetreeform = NULL;} private void treeviewinclunodemouseclick (Object sender, treenodemouseclickeventargs E) {} private void treeview1_afterselect (OBJ ECT sender, treevieweventargs e) {bindinglist <fieldinfoname> gridbindinglist = new bindinglist <fieldinfoname> (); // list <fieldinfoname> gridlist = new list <fieldinfoname> (); if (this. treeview1.selectednode. parent! = NULL) {layers = mapcontrol. map. layers; foreach (layer item in layers) {This. layers. add (item);} layer Layer = This. layers [layerform. _ layerform. combobox1.selectedindex]; selection = layer. selection; recordset = selection. torecordset (); 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 (); // always error} 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 ("select subnode") ;}} private void datagridviewinclucellendedit (Object sender, datagridviewcelleventargs e) {} private void btn_ OK _click (Object sender, eventargs e) {layers = mapcontrol. map. layers; foreach (layer item in layers) {This. layers. add (item);} layer Layer = This. layers [layerform. _ layerform. combobox1.selectedindex]; selection = layer. selection; recordset = selection. torecordset (); 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 ("attribute value modified successfully");} private void checkbox1_checkedchanged (Object sender, eventargs e ){}}}

 



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.