Example #1
0
 private void tv_CatalogTree_MouseDown(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Right)
     {
         myTreeNode selectNode = this.tv_CatalogTree.GetNodeAt(e.X, e.Y) as myTreeNode;
         this.tv_CatalogTree.SelectedNode = selectNode;
         if (selectNode.nodeType == NodeObjectType.FeatureClass)
         {
             cMenuCatalog.Items.Clear();
             ToolStripMenuItem menuEnableAttachment = new ToolStripMenuItem();
             menuEnableAttachment.Click += new EventHandler(menuEnableAttachment_Click);
             IFeatureClass fc = selectNode.Tag as IFeatureClass;
             if (fc.HasAttachments())
             {
                 menuEnableAttachment.Text = "禁用附件";
             }
             else
             {
                 menuEnableAttachment.Text = "启用附件";
             }
             cMenuCatalog.Items.Add(menuEnableAttachment);
             cMenuCatalog.Show(Cursor.Position);
         }
     }
 }
Example #2
0
 private void btn_AttachmentManager_Click(object sender, EventArgs e)
 {
     if (curSelectFc.HasAttachments())
     {
         AttachmentMangerForm form = new AttachmentMangerForm(curSelectFc, curSelectFid);
         form.ShowDialog();
     }
     else
     {
         MessageBox.Show(string.Format("该要素所在要素类{0}未启用附件", curSelectFc.Name));
     }
 }
Example #3
0
        private void menuEnableAttachment_Click(object sender, EventArgs e)
        {
            myTreeNode    selectNode = this.tv_CatalogTree.SelectedNode as myTreeNode;
            IFeatureClass fc         = selectNode.Tag as IFeatureClass;

            if (fc.HasAttachments())
            {
                if (MessageBox.Show("禁用附件功能会删除所有现存的附件,请确认!", "警告", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK)
                {
                    fc.DisableAttachment();
                }
            }
            else
            {
                fc.EnableAttachment();
            }
        }