Пример #1
0
        //
        // Vertical Scrollbar scroll event
        //
        private void vScrollBar_Scroll(object sender, ScrollEventArgs e)
        {
            offsetPoint.Y = e.NewValue;
            Invalidate();

            VerticalScroll?.Invoke(this, e);
        }
Пример #2
0
        //
        // Mouse Move event handler. Used to drag the viewport
        //
        protected override void OnMouseMove(MouseEventArgs e)
        {
            base.OnMouseMove(e);

            if (draggingViewport)
            {
                offsetPoint = new Point(-MousePosition.X + mouseOffset.X, -MousePosition.Y + mouseOffset.Y);

                // Fire scroll events
                HorizontalScroll?.Invoke(this, new ScrollEventArgs(ScrollEventType.ThumbPosition, offsetPoint.X));
                VerticalScroll?.Invoke(this, new ScrollEventArgs(ScrollEventType.ThumbPosition, offsetPoint.Y));

                ClipTransform();
                Invalidate();
            }
        }
Пример #3
0
        protected override void WndProc(ref Message m)
        {
            try {
                if (m.Msg == WM_ERASEBKGND)
                {
                    m.Result = IntPtr.Zero;
                    return;
                }
                if (m.Msg == 0x0115)
                {
                    if (VerticalScroll != null)
                    {
                        VerticalScroll.Invoke(this, EventArgs.Empty);
                    }
                }

                base.WndProc(ref m);
            } catch (AccessViolationException) { }
        }