예제 #1
0
        public Form1()
        {
            InitializeComponent();

            dha.nSize        = System.Runtime.InteropServices.Marshal.SizeOf(dha);
            dha.nRoundRadius = 2;

            PDFXEdit.IUIX_Inst uiInst = (PDFXEdit.IUIX_Inst)pdfCtl.Inst.GetExtension("UIX");

            brush               = uiInst.CreateNewBrush();
            pen                 = uiInst.CreateNewPen();
            brush.Color0        = (uint)ColorTranslator.ToWin32(Color.Blue) | 0xFF000000;
            brush.Opacity       = 0.3;
            brush.BlendType     = PDFXEdit.UIX_BlendType.UIX_BlendType_Multiply;
            pen.Brush.Color0    = brush.Color0;
            pen.Brush.Opacity   = 0.9;
            pen.Brush.BlendType = PDFXEdit.UIX_BlendType.UIX_BlendType_Multiply;

            PDFXEdit.IAUX_Inst auxInst = (PDFXEdit.IAUX_Inst)pdfCtl.Inst.GetExtension("AUX");
            mh = auxInst.MathHelper;

            dhp       = new DrawHighlightOnPagesCallback();
            dhp.brush = brush;
            dhp.pen   = pen;
            dhp.mh    = mh;
        }
예제 #2
0
        private void btnOpen_Click(object sender, EventArgs e)
        {
            bool timerStarted = timer1.Enabled;

            timer1.Stop();

            uint oldDocId = 0;

            if (pdfCtl.HasDoc)
            {
                oldDocId = pdfCtl.Doc.ID;
            }

            pdfCtl.OpenDocWithDlg();

            uint newDocId = 0;

            if (pdfCtl.HasDoc)
            {
                newDocId = pdfCtl.Doc.ID;
            }

            if (wordsRanges == null)
            {
                PDFXEdit.IAUX_Inst auxInst = (PDFXEdit.IAUX_Inst)pdfCtl.Inst.GetExtension("AUX");
                wordsRanges = auxInst.CreateNumArray();
                wordRange   = auxInst.CreateNumArray();
            }

            if (newDocId != oldDocId)             // new document opened
            {
                // restart
                endReached         = false;
                curPage            = -1;
                curWord            = -1;
                docHighlighter     = null;
                pageSolidHighlight = null;
                dhp.Stop(false);
            }

            if (pdfCtl.HasDoc)
            {
                if (timerStarted)
                {
                    timer1.Start();
                }
            }

            UpdateStartBtn();
        }