private void HookManager_MouseDown(object sender, MouseEventArgs e)
        {
            if (!this.MouseInPage(this.pageViewControl1.PointToClient(e.Location)) || e.Button != MouseButtons.Left)
            {
                return;
            }
            PageLink pageLink = this.SearchLink(e.Location);

            if (pageLink != null)
            {
                switch (pageLink.Action.Kind)
                {
                case LinkActionKind.actionGoTo:
                    PageLinkGoTo action1 = pageLink.Action as PageLinkGoTo;
                    if (action1.Destination != null)
                    {
                        this._pdfDoc.CurrentPage = action1.Destination.Page;
                        PointF dev = this._pdfDoc.PointUserToDev(new PointF((float)action1.Destination.Left, (float)action1.Destination.Top));
                        if (action1.Destination.ChangeTop)
                        {
                            this.ScrolltoTop((int)dev.Y);
                        }
                        else
                        {
                            this.ScrolltoTop(0);
                        }
                        this._pdfDoc.RenderPage(this.pageViewControl1.Handle);
                        this.Render();
                        break;
                    }
                    if (action1.DestinationName != null)
                    {
                        break;
                    }
                    break;

                case LinkActionKind.actionURI:
                    PageLinkURI action2 = pageLink.Action as PageLinkURI;
                    if (MessageBox.Show("Launching external application" + Environment.NewLine + action2.URL, this.Text, MessageBoxButtons.OKCancel) != DialogResult.OK)
                    {
                        break;
                    }
                    new Process()
                    {
                        StartInfo =
                        {
                            FileName  = PDFViewer1С.GetDefaultBrowserPath(),
                            Arguments = action2.URL
                        }
                    }.Start();
                    break;
                }
            }
            else
            {
                this._pointCurrent   = e.Location;
                this._pointStart     = e.Location;
                this._bMouseCaptured = true;
            }
        }
        public PDFViewer1С()
        {
            this.InitializeComponent();
            PDFViewer1С.Instance = this;

            this.tvwOutline.BeforeExpand   += new TreeViewCancelEventHandler(this.tvwOutline_BeforeExpand);
            this.tvwOutline.NodeMouseClick += new TreeNodeMouseClickEventHandler(this.tvwOutline_NodeMouseClick);
            this.Resize += new EventHandler(this.frmPDFViewer_Resize);

            HookManager.MouseDown += new MouseEventHandler(this.HookManager_MouseDown);
            HookManager.MouseUp   += new MouseEventHandler(this.HookManager_MouseUp);
            HookManager.MouseMove += new MouseEventHandler(this.HookManager_MouseMove);
        }
Ejemplo n.º 3
0
 public PDFViewer1С()
 {
     this.InitializeComponent();
     PDFViewer1С.Instance = this;
 }