Example #1
0
 /// <summary>
 /// 点击字段属性
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void toolStripMenuItemFieldInfo_Click(object sender, EventArgs e)
 {
     string fieldinfo_name = selectNode.Text;
     var fieldinfo = controlOperation.GetFieldInfoByName(fieldinfo_name);
     if (fieldinfo != null)
     {
         FieldInfoForm form = new FieldInfoForm(fieldinfo);
         form.Show();
     }
 }
Example #2
0
        private void toolStripMenuItemFieldInfo_Click(object sender, EventArgs e)
        {
            string          fieldinfo_name = selectNode.Text;
            string          fc_name        = selectNode.Parent.Text;
            string          set_name       = selectNode.Parent.Parent.Text;
            myTreeNode      node           = (myTreeNode)selectNode.Parent.Parent.Parent;
            IConnectionInfo ci             = node.con;

            IDataSource          ds         = null;
            IFeatureDataSet      dataset    = null;
            IFeatureClass        fc         = null;
            IFieldInfoCollection fieldinfos = null;

            try
            {
                ds         = dsFactory.OpenDataSource(ci);
                dataset    = ds.OpenFeatureDataset(set_name);
                fc         = dataset.OpenFeatureClass(fc_name);
                fieldinfos = fc.GetFields();
                for (int i = 0; i < fieldinfos.Count; i++)
                {
                    IFieldInfo fieldinfo = fieldinfos.Get(i);
                    if (null == fieldinfo)
                    {
                        continue;
                    }
                    if (fieldinfo_name == fieldinfo.Name)
                    {
                        FieldInfoForm form = new FieldInfoForm(fieldinfo);
                        form.Show();
                    }
                }
            }
            catch (COMException ex)
            {
                System.Diagnostics.Trace.WriteLine(ex.Message);
            }
            finally
            {
                if (ds != null)
                {
                    //Marshal.ReleaseComObject(ds);
                    ds = null;
                }
                if (dataset != null)
                {
                    //Marshal.ReleaseComObject(dataset);
                    dataset = null;
                }
                if (fc != null)
                {
                    //Marshal.ReleaseComObject(fc);
                    fc = null;
                }
                if (fieldinfos != null)
                {
                    //Marshal.ReleaseComObject(fieldinfos);
                    fieldinfos = null;
                }
            }
        }