static public int RemoveAttachment(Form1 Parent) { if (Parent.m_CurDoc == null) { return(0); } if (Parent.AttachmentView.SelectedItems.Count == 0) { MessageBox.Show("Please select attachment from the Attachments list.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); return(0); } Form1.ListItemAttachment currentAnnot = Parent.AttachmentView.SelectedItems[0] as Form1.ListItemAttachment; if (currentAnnot.SubItems[currentAnnot.SubItems.Count - 1].Text == "Embedded File Item") { IPXC_NameTree attachments = Parent.m_CurDoc.GetNameTree("EmbeddedFiles"); attachments.Remove(currentAnnot.SubItems[0].Text); return((int)Form1.eFormUpdateFlags.efuf_Attachments | (int)Form1.eFormUpdateFlags.efuf_Annotations); } IPXC_Pages pages = Parent.m_CurDoc.Pages; IPXC_Page page = pages[(uint)(currentAnnot.m_nPageNumber)]; page.RemoveAnnots((uint)currentAnnot.m_nIndexOnPage, 1); Marshal.ReleaseComObject(page); Marshal.ReleaseComObject(pages); return((int)Form1.eFormUpdateFlags.efuf_Attachments | (int)Form1.eFormUpdateFlags.efuf_Annotations); }
static public int RemoveAnnotations(Form1 Parent) { if (Parent.m_CurDoc == null) { Document.CreateNewDoc(Parent); } IPXC_Pages pages = Parent.m_CurDoc.Pages; IPXC_Page page = pages[Parent.CurrentPage]; page.RemoveAnnots(0, page.GetAnnotsCount()); Marshal.ReleaseComObject(page); Marshal.ReleaseComObject(pages); return((int)Form1.eFormUpdateFlags.efuf_Annotations); }