Exemplo n.º 1
0
        protected override void OnSetCursor(SetCursorEventArgs e)
        {
            _cachedLink = null;

            if (_pageCacheValid)
            {
                var bounds     = GetScrollClientArea();
                int maxWidth   = (int)(_maxWidth * _scaleFactor) + ShadeBorder.Size.Horizontal + PageMargin.Horizontal;
                int leftOffset = (HScroll ? DisplayRectangle.X : (bounds.Width - maxWidth) / 2) + maxWidth / 2;

                var displayLocation = DisplayRectangle.Location;

                var location = new Point(
                    e.Location.X,
                    e.Location.Y - displayLocation.Y
                    );

                for (int page = _visiblePageStart; page <= _visiblePageEnd; page++)
                {
                    var links = GetPageLinks(page);

                    var pageLocation = location;
                    var pageBounds   = _pageCache[page].Bounds;
                    pageLocation.X -= leftOffset + pageBounds.Left;
                    pageLocation.Y -= pageBounds.Top;

                    foreach (var link in links.Links)
                    {
                        if (link.Bounds.Contains(pageLocation))
                        {
                            _cachedLink = link;
                            e.Cursor    = Cursors.Hand;
                            return;
                        }
                    }
                }
            }

            base.OnSetCursor(e);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Called whent he cursor changes.
        /// </summary>
        /// <param name="e">The event args.</param>
        protected override void OnSetCursor(SetCursorEventArgs e)
        {
            _cachedLink = null;

            if (_pageCacheValid)
            {
                var offset = GetScrollOffset();
                var bounds = GetScrollClientArea();

                var displayLocation = DisplayRectangle.Location;

                var location = new Point(
                    e.Location.X,
                    e.Location.Y - displayLocation.Y
                    );

                for (int page = _visiblePageStart; page <= _visiblePageEnd; page++)
                {
                    var links = GetPageLinks(page);

                    var pageLocation = location;
                    var pageBounds   = _pageCache[page].Bounds;
                    pageLocation.X -= offset.Width + pageBounds.Left;
                    pageLocation.Y -= pageBounds.Top;

                    foreach (var link in links.Links)
                    {
                        if (link.Bounds.Contains(pageLocation))
                        {
                            _cachedLink = link;
                            e.Cursor    = Cursors.Hand;
                            return;
                        }
                    }
                }
            }

            base.OnSetCursor(e);
        }
Exemplo n.º 3
0
        protected override void OnSetCursor(SetCursorEventArgs e)
        {
            _cachedLink = null;

            if (_pageCacheValid)
            {
                var bounds = GetScrollClientArea();
                int maxWidth = (int)(_maxWidth * _scaleFactor) + ShadeBorder.Size.Horizontal + PageMargin.Horizontal;
                int leftOffset = (HScroll ? DisplayRectangle.X : (bounds.Width - maxWidth) / 2) + maxWidth / 2;

                var displayLocation = DisplayRectangle.Location;

                var location = new Point(
                    e.Location.X,
                    e.Location.Y - displayLocation.Y
                );

                for (int page = _visiblePageStart; page <= _visiblePageEnd; page++)
                {
                    var links = GetPageLinks(page);

                    var pageLocation = location;
                    var pageBounds = _pageCache[page].Bounds;
                    pageLocation.X -= leftOffset + pageBounds.Left;
                    pageLocation.Y -= pageBounds.Top;

                    foreach (var link in links.Links)
                    {
                        if (link.Bounds.Contains(pageLocation))
                        {
                            _cachedLink = link;
                            e.Cursor = Cursors.Hand;
                            return;
                        }
                    }
                }
            }

            base.OnSetCursor(e);
        }
Exemplo n.º 4
0
 public LinkClickEventArgs(PdfPageLink link)
 {
     Link = link;
 }
Exemplo n.º 5
0
 public PageLink(PdfPageLink link, Rectangle bounds)
 {
     Link   = link;
     Bounds = bounds;
 }