static public int AddPopupAnnotation(Form1 Parent) { if (Parent.m_CurDoc == null) { Document.CreateNewDoc(Parent); } IPXC_UndoRedoData urData = null; IPXC_Pages pages = Parent.m_CurDoc.Pages; IPXC_Page firstPage = pages[0]; PXC_Rect rcPage = firstPage.get_Box(PXC_BoxType.PBox_PageBox); Marshal.ReleaseComObject(firstPage); IPXC_Page page = pages.InsertPage(0, ref rcPage, out urData); IPXS_Inst pxsInst = Parent.m_pxcInst.GetExtension("PXS"); IAUX_Inst auxInst = Parent.m_pxcInst.GetExtension("AUX"); //Getting Popup annotation atom for the InsertNewAnnot method uint nSquare = pxsInst.StrToAtom("Square"); double nCX = (rcPage.right - rcPage.left) / 2.0; double nCY = (rcPage.top - rcPage.bottom) / 2.0; PXC_Rect rcOut = new PXC_Rect(); rcOut.left = nCX - 200; rcOut.bottom = nCY + 200; rcOut.right = nCX + 200; rcOut.top = nCY + 300; IPXC_Annotation sqAnnot = unchecked (page.InsertNewAnnot(nSquare, ref rcOut)); IPXC_AnnotData_SquareCircle aSData = sqAnnot.Data as IPXC_AnnotData_SquareCircle; var color = auxInst.CreateColor(ColorType.ColorType_RGB); color.SetRGB(0.0f, 0.8f, 0.8f); aSData.Color = color; aSData.Title = "Square annotation 1."; aSData.Contents = "Popup Annotation 1."; sqAnnot.Data = aSData; //Getting Text annotation atom for the InsertNewAnnot method uint nText = pxsInst.StrToAtom("Popup"); IPXC_Annotation annot = unchecked (page.InsertNewAnnot(nText, ref rcOut)); IPXC_AnnotData_Popup aData = annot.Data as IPXC_AnnotData_Popup; aData.Opened = true; annot.Data = aData; sqAnnot.SetPopup(annot); Marshal.ReleaseComObject(page); Marshal.ReleaseComObject(pages); return((int)Form1.eFormUpdateFlags.efuf_Annotations); }
static public int DrawSquareAnnotation(Form1 Parent) { if (Parent.m_CurDoc == null) { Document.CreateNewDoc(Parent); } IPXC_Pages pages = Parent.m_CurDoc.Pages; IPXC_Page page = pages[0]; PXC_Rect rcPage = page.get_Box(PXC_BoxType.PBox_PageBox); IPXS_Inst pxsInst = Parent.m_pxcInst.GetExtension("PXS"); IAUX_Inst auxInst = Parent.m_pxcInst.GetExtension("AUX"); //Getting Square annotation atom for the InsertNewAnnot method uint nSquare = pxsInst.StrToAtom("Square"); //Placing it in the center of page double nCX = (rcPage.right - rcPage.left) / 2.0; double nCY = (rcPage.top - rcPage.bottom) / 2.0; PXC_Rect rcOut = new PXC_Rect(); rcOut.left = nCX - 200; rcOut.bottom = nCY - 100; rcOut.right = nCX + 200; rcOut.top = nCY + 100; IPXC_Annotation annot = page.InsertNewAnnot(nSquare, ref rcOut); IPXC_AnnotData_SquareCircle aData = annot.Data as IPXC_AnnotData_SquareCircle; aData.Opacity = 0.7; var color = auxInst.CreateColor(ColorType.ColorType_RGB); color.SetRGB(0.0f, 1.0f, 1.0f); aData.Color = color; //Setting dashed border pattern var border = new PXC_AnnotBorder(); border.nStyle = PXC_AnnotBorderStyle.ABS_Dashed; border.nWidth = 4.0f; border.DashArray = new float[10]; border.DashArray[0] = border.DashArray[1] = 16.0f; //Width of dashes border.nDashCount = 2; //Number of dashes aData.set_Border(border); annot.Data = aData; Marshal.ReleaseComObject(page); Marshal.ReleaseComObject(pages); return((int)Form1.eFormUpdateFlags.efuf_Annotations); }
static public int AddSquareAndCircleAnnotation(Form1 Parent) { if (Parent.m_CurDoc == null) { Document.CreateNewDoc(Parent); } IPXC_UndoRedoData urData = null; IPXC_Pages pages = Parent.m_CurDoc.Pages; IPXC_Page firstPage = pages[0]; PXC_Rect rcPage = firstPage.get_Box(PXC_BoxType.PBox_PageBox); Marshal.ReleaseComObject(firstPage); IPXC_Page page = pages.InsertPage(0, ref rcPage, out urData); IPXS_Inst pxsInst = Parent.m_pxcInst.GetExtension("PXS"); IAUX_Inst auxInst = Parent.m_pxcInst.GetExtension("AUX"); //Getting Square and Circle annotations atom for the InsertNewAnnot method uint nSquare = pxsInst.StrToAtom("Square"); uint nCircle = pxsInst.StrToAtom("Circle"); double nCX = (rcPage.right - rcPage.left) / 2.0; double nCY = (rcPage.top - rcPage.bottom) / 2.0; PXC_Rect rcOut = new PXC_Rect(); rcOut.left = nCX - 200; rcOut.bottom = nCY + 200; rcOut.right = nCX + 200; rcOut.top = nCY + 300; IPXC_Annotation annot = unchecked (page.InsertNewAnnot(nSquare, ref rcOut)); IPXC_AnnotData_SquareCircle aData = annot.Data as IPXC_AnnotData_SquareCircle; aData.Title = "Square annotation 1."; annot.Data = aData; rcOut.bottom -= 150; rcOut.top -= 150; annot = unchecked (page.InsertNewAnnot(nSquare, ref rcOut)); aData = annot.Data as IPXC_AnnotData_SquareCircle; aData.Title = "Square annotation 2."; IColor color = auxInst.CreateColor(ColorType.ColorType_RGB); color.SetRGB(0.0f, 0.0f, 0.0f); aData.SColor = color; color.SetRGB(0.15f, 0.5f, 0.12f); aData.FColor = color; annot.Data = aData; rcOut.bottom -= 150; rcOut.top -= 150; annot = unchecked (page.InsertNewAnnot(nCircle, ref rcOut)); aData = annot.Data as IPXC_AnnotData_SquareCircle; aData.Title = "Circle annotation 3."; color.SetRGB(0.0f, 0.0f, 0.0f); aData.SColor = color; color.SetRGB(0.5f, 0.5f, 0.5f); aData.FColor = color; //Setting dashed border pattern PXC_AnnotBorder border = new PXC_AnnotBorder(); border.nStyle = PXC_AnnotBorderStyle.ABS_Dashed; border.nWidth = 4.0f; border.DashArray = new float[] { 10f, 8f, 6f, 4f, 2f, 2f, 4f, 6f, 8f, 10f }; //Width of dashes border.nDashCount = 4; //Number of dashes aData.set_Border(border); annot.Data = aData; rcOut.bottom -= 150; rcOut.top -= 150; annot = unchecked (page.InsertNewAnnot(nCircle, ref rcOut)); aData = annot.Data as IPXC_AnnotData_SquareCircle; aData.Title = "Circle annotation 4."; color.SetRGB(0.0f, 0.0f, 0.0f); aData.SColor = color; color.SetRGB(0.5f, 0.5f, 0.5f); aData.FColor = color; //Setting dashed border pattern border = new PXC_AnnotBorder(); border.nStyle = PXC_AnnotBorderStyle.ABS_Solid; border.nWidth = 5.0f; aData.set_Border(border); annot.Data = aData; Marshal.ReleaseComObject(page); Marshal.ReleaseComObject(pages); return((int)Form1.eFormUpdateFlags.efuf_Annotations); }