예제 #1
0
        private int SearchCallBack(object sender, SearchArgs e)
        {
            int lFound = 0;

            if (_pdfDoc != null)
            {
                //PDFLibNet.xPDFParams.ErrorQuiet = false;
                //PDFLibNet.xPDFParams.ErrorFile="C:\\errorstd.log";
                _pdfDoc.SearchCaseSensitive = e.Exact;

                if (e.FromBegin)
                {
                    lFound = _pdfDoc.FindFirst(e.Text,
                                               e.WholeDoc ? PDFLibNet.PDFSearchOrder.PDFSearchFromdBegin : PDFLibNet.PDFSearchOrder.PDFSearchFromCurrent,
                                               e.Up,
                                               e.WholeWord);
                }
                else if (e.FindNext)
                {
                    if (e.Up)
                    {
                        lFound = _pdfDoc.FindPrevious(e.Text);
                    }
                    else
                    {
                        lFound = _pdfDoc.FindNext(e.Text);
                    }
                }
                else
                {
                    lFound = _pdfDoc.FindText(e.Text,
                                              _pdfDoc.CurrentPage,
                                              (e.WholeDoc ? PDFLibNet.PDFSearchOrder.PDFSearchFromdBegin : PDFLibNet.PDFSearchOrder.PDFSearchFromCurrent),
                                              e.Exact,
                                              e.Up,
                                              true,
                                              e.WholeWord);
                }
                if (lFound > 0)
                {
                    _pdfDoc.CurrentPage = _pdfDoc.SearchResults[0].Page;
                    UpdateText();
                    _pdfDoc.RenderPage(pageViewControl1.Handle);
                    FocusSearchResult(_pdfDoc.SearchResults[0]);
                    Render();
                }
            }
            return(lFound);
        }