Beispiel #1
0
        protected void StartOutOfBoundsSelection(int direction)
        {
            if (VScrollBar == null || !VScrollBar.Visible)
            {
                return;
            }

            OutOfBondsDirection = direction;
            if (OutOfBoundsSelectionTimer == null)
            {
                OutOfBoundsSelectionTimer = new TaskTimer(50, () => {
                    if (OutOfBondsDirection < 0)
                    {
                        RowManager.SetCursorPosition(0, 0 - ScrollOffsetY - Padding.Top - RowManager.LineHeight);
                        SetSelection();
                    }
                    else if (OutOfBondsDirection > 0)
                    {
                        RowManager.SetCursorPosition(0, Height - ScrollOffsetY + Padding.Height + RowManager.LineHeight + RowManager.LineHeight);
                        SetSelection();
                    }

                    EnsureCurrentRowVisible();
                    VScrollBar.Value += OutOfBondsDirection * VScrollBar.SmallChange;
                }, 500);
                OutOfBoundsSelectionTimer.Start();
            }
            else if (!OutOfBoundsSelectionTimer.Enabled)
            {
                OutOfBoundsSelectionTimer.Start();
            }
        }
Beispiel #2
0
        public override void OnMouseDown(MouseButtonEventArgs e)
        {
            base.OnMouseDown(e);

            if (e.Button == MouseButton.Left)
            {
                RowManager.SetCursorPosition(e.X - Left - ScrollOffsetX - Padding.Left, e.Y - Top - ScrollOffsetY - Padding.Top);
                m_SelStart = RowManager.AbsCursorPosition;
                if (!ModifierKeys.ShiftPressed)
                {
                    SelLength = 0;
                }
                IsMouseMoving = true;
                CursorOn      = true;
            }
            Invalidate();
        }
Beispiel #3
0
 public override void OnMouseMove(MouseMoveEventArgs e)
 {
     base.OnMouseMove(e);
     if (IsMouseMoving)
     {
         if (e.Y > Bottom - 2)
         {
             StartOutOfBoundsSelection(1);
         }
         else if (e.Y < Top + 2)
         {
             StartOutOfBoundsSelection(-1);
         }
         else
         {
             Invalidate(1);
             StopOutOfBoundsSelection();
             EnsureCurrentRowVisible();
             RowManager.SetCursorPosition(e.X - Left - ScrollOffsetX - Padding.Left, e.Y - Top - ScrollOffsetY - Padding.Top);
             SetSelection();
         }
     }
 }