コード例 #1
0
ファイル: Main.cs プロジェクト: Gnostice/DocumentStudio.NET
        private void DocumentViewer1_DragDrop(object sender, DragEventArgs e)
        {
            string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);

            if (files.Length > 0)
            {
                try
                {
                    DocumentViewer1.LoadDocument(files[0]);

                    cmbZoomPercent.FlatStyle         = FlatStyle.Standard;
                    DocumentViewer1.Zoom.ZoomPercent = double.Parse(cmbZoomPercent.Text.Remove(cmbZoomPercent.Text.Length - 1));
                    lblPageCount.Text = DocumentViewer1.PageCount.ToString();
                    DocumentViewer1_LastPageRead(DocumentViewer1, new Gnostice.Core.LoadCompletedEventArgs(DocumentViewer1.PageCount));
                    this.Filename = files[0];
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }
コード例 #2
0
ファイル: Main.cs プロジェクト: Gnostice/DocumentStudio.NET
        private void btnOpen_Click(object sender, EventArgs e)
        {
            if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                try
                {
                    Filename  = openFileDialog1.FileName;
                    this.Text = System.IO.Path.GetFileName(Filename) + " - Gnostice WinForms Document Viewer";
                    DocumentViewer1.LoadDocument(openFileDialog1.FileName);
                    cmbZoomPercent.FlatStyle = FlatStyle.Standard;



                    //DocumentViewer1.Zoom.ZoomPercent = double.Parse(cmbZoomPercent.Text.Remove(cmbZoomPercent.Text.Length - 1));
                    DocumentViewer1_LastPageRead(DocumentViewer1, e as Gnostice.Core.LoadCompletedEventArgs);
                    lblPageCount.Text = DocumentViewer1.PageCount.ToString();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }