コード例 #1
0
        // Hitting enter in the text box or losing mouse
        // focusfrom the textbox both invoke this method.
        private void PageNumberTextBox_changed()
        {
            int newPDPagenum  = int.Parse(PageNumberTextBox.Text) - 1;
            int savePDPagenum = currentPDPagenum;

            try
            {
                if (currentPDPagenum != newPDPagenum)
                {
                    currentPDPagenum = newPDPagenum;
                    PDFPagepicturebox.ClearList();
                    if (SearchWord != null)
                    {
                        searchwords();
                    }
                    drawcurrentPDFpage();
                }
            }
            catch
            {
                currentPDPagenum = savePDPagenum;
                PDFPagepicturebox.ClearList();
                if (SearchWord != null)
                {
                    searchwords();
                }
                drawcurrentPDFpage();
                throw;
            }
        }
コード例 #2
0
        private void perform_searchform()
        {
            String textboxword = TextSearch.Text.ToString();

            if (textboxword.Length == 0)
            {
                PDFPagepicturebox.ClearList();
                SearchWord = null;
                drawcurrentPDFpage();
                return;
            }

            if (SearchWord != null && SearchWord != textboxword)
            {
                PDFPagepicturebox.ClearList();
                drawcurrentPDFpage();
            }

            if (SearchWord == null || SearchWord != textboxword)
            {
                SearchWord = textboxword;
                if (PDFDoc != null)
                {
                    searchwords();
                    drawcurrentPDFpage();
                }
            }
        }
コード例 #3
0
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            PDFPagepicturebox.ClearList();
            TextSearch.Text = null;
            OpenFileDialog dialog = new OpenFileDialog();

            dialog.Filter = "PDF File (*.pdf)|*.pdf";
            dialog.Title  = "Select a PDF file";
            DialogResult result = dialog.ShowDialog();

            if (result == System.Windows.Forms.DialogResult.OK)
            {
                String FileName = dialog.FileName;
                try
                {
                    if (PDFDoc != null)
                    {
                        PDFDoc.Dispose();
                    }
                    PDFDoc = new Document(FileName);
                    DisplayPDFForm.ActiveForm.Text = "PDFL Viewer - " + FileName;
                    maxpages         = PDFDoc.NumPages;
                    currentPDPagenum = 0;
                    scalefactor      = 1.0;
                    documentpassword = null;
                    drawcurrentPDFpage();
                }
                catch (Exception exc)
                {
                    MessageBox.Show("The File " + FileName + " cannot be opened. " + exc.ToString());
                }
            }
        }
コード例 #4
0
 private void forwardonedocpage_Click(object sender, EventArgs e)
 {
     if (PDFDoc != null & (currentPDPagenum + 1) < maxpages)
     {
         currentPDPagenum++;
         PDFPagepicturebox.ClearList();
         drawcurrentPDFpage();
         if (SearchWord != null)
         {
             searchwords();
         }
     }
 }
コード例 #5
0
 private void rewindtodocstart_Click(object sender, EventArgs e)
 {
     if (PDFDoc != null)
     {
         currentPDPagenum = 0;
         PDFPagepicturebox.ClearList();
         drawcurrentPDFpage();
         if (SearchWord != null)
         {
             searchwords();
         }
     }
 }
コード例 #6
0
 private void forwardtodocend_Click(object sender, EventArgs e)
 {
     if (PDFDoc != null)
     {
         currentPDPagenum = maxpages - 1;
         PDFPagepicturebox.ClearList();
         drawcurrentPDFpage();
         if (SearchWord != null)
         {
             searchwords();
         }
     }
 }
コード例 #7
0
 private void gobackonepage_Click(object sender, EventArgs e)
 {
     if (PDFDoc != null & currentPDPagenum > 0)
     {
         currentPDPagenum -= 1;
         PDFPagepicturebox.ClearList();
         drawcurrentPDFpage();
         if (SearchWord != null)
         {
             searchwords();
         }
     }
 }