コード例 #1
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 location = new Point(
                    e.Location.X - offset.Width,
                    e.Location.Y - offset.Height
                    );

                for (int page = _visiblePageStart; page <= _visiblePageEnd; page++)
                {
                    foreach (var link in GetPageLinks(page))
                    {
                        if (link.Bounds.Contains(location))
                        {
                            _cachedLink = link;
                            e.Cursor    = Cursors.Hand;
                            return;
                        }
                    }
                }
            }

            base.OnSetCursor(e);
        }
コード例 #2
0
        private void WmSetCursor(ref Message m)
        {
            var e = new SetCursorEventArgs(PointToClient(Cursor.Position));

            OnSetCursor(e);
            Cursor.Current = e.Cursor ?? Cursor;
        }
コード例 #3
0
        protected override void OnSetCursor(SetCursorEventArgs e)
        {
            if (MousePanningEnabled && _canPan && e.HitTest == HitTest.Client)
            {
                e.Cursor = PanCursor;
            }

            base.OnSetCursor(e);
        }
コード例 #4
0
        protected virtual void OnSetCursor(SetCursorEventArgs e)
        {
            var handler = SetCursor;

            if (handler != null)
            {
                handler(this, e);
            }
        }
コード例 #5
0
        private void WmSetCursor(ref Message m)
        {
            var e = new SetCursorEventArgs(
                PointToClient(Cursor.Position),
                (HitTest)(m.LParam.ToInt32() & 0xffff)
                );

            OnSetCursor(e);
            Cursor.Current = e.Cursor ?? Cursor;
        }
コード例 #6
0
ファイル: PdfRenderer.cs プロジェクト: moclad/PdfiumViewer
        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);
        }
コード例 #7
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 location = new Point(
                    e.Location.X - offset.Width,
                    e.Location.Y - offset.Height
                    );

                for (int page = _visiblePageStart; page <= _visiblePageEnd; page++)
                {
                    foreach (var link in GetPageLinks(page))
                    {
                        if (link.Bounds.Contains(location))
                        {
                            _cachedLink = link;
                            e.Cursor    = Cursors.Hand;
                            return;
                        }
                    }
                }

                if (_cursorMode == PdfViewerCursorMode.TextSelection)
                {
                    var state = GetMouseState(e.Location);
                    if (state.CharacterIndex >= 0)
                    {
                        e.Cursor = Cursors.IBeam;
                        return;
                    }
                }
            }

            base.OnSetCursor(e);
        }
コード例 #8
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);
        }
コード例 #9
0
ファイル: PdfRenderer.cs プロジェクト: moclad/PdfiumViewer
        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);
        }
コード例 #10
0
 private void WmSetCursor(ref Message m)
 {
     var e = new SetCursorEventArgs(PointToClient(Cursor.Position));
     OnSetCursor(e);
     Cursor.Current = e.Cursor ?? Cursor;
 }
コード例 #11
0
 protected virtual void OnSetCursor(SetCursorEventArgs e)
 {
     var handler = SetCursor;
     if (handler != null)
         handler(this, e);
 }
コード例 #12
0
 private void WmSetCursor(ref Message m)
 {
     var e = new SetCursorEventArgs(
         PointToClient(Cursor.Position),
         (HitTest)(m.LParam.ToInt32() & 0xffff)
     );
     OnSetCursor(e);
     Cursor.Current = e.Cursor ?? Cursor;
 }
コード例 #13
0
        protected override void OnSetCursor(SetCursorEventArgs e)
        {
            if (_canPan && e.HitTest == HitTest.Client)
                e.Cursor = PanCursor;

            base.OnSetCursor(e);
        }