Beispiel #1
0
        /// <summary>
        /// Handles mouse wheel events.
        /// </summary>
        /// <param name="e">The <see cref="System.Windows.Forms.MouseEventArgs"/> instance containing the event data.</param>
        public void HandleMouseWheel(MouseEventArgs e)
        {
            int scrollDistance = _mouseWheelHandler.GetScrollAmount(e);

            if (scrollDistance == 0)
            {
                return;
            }
            if ((ModifierKeys & Keys.Control) != 0 && TextEditorProperties.MouseWheelTextZoom)
            {
                if (scrollDistance > 0)
                {
                    _motherTextEditorControl.Font = new Font(_motherTextEditorControl.Font.Name, _motherTextEditorControl.Font.Size + 1);
                }
                else
                {
                    _motherTextEditorControl.Font = new Font(_motherTextEditorControl.Font.Name, Math.Max(6, _motherTextEditorControl.Font.Size - 1));
                }
            }
            else
            {
                if (TextEditorProperties.MouseWheelScrollDown)
                {
                    scrollDistance = -scrollDistance;
                }
                int newValue = _vScrollBar.Value + _vScrollBar.SmallChange * scrollDistance;
                _vScrollBar.Value = Math.Max(_vScrollBar.Minimum, Math.Min(_vScrollBar.Maximum - _vScrollBar.LargeChange + 1, newValue));
            }
        }
        /// <summary>
        /// Handles mouse wheel events.
        /// </summary>
        /// <param name="e">The <see cref="System.Windows.Forms.MouseEventArgs"/> instance containing the event data.</param>
        public void HandleMouseWheel(MouseEventArgs e)
        {
            int scrollDistance = _mouseWheelHandler.GetScrollAmount(e);

            if (scrollDistance == 0)
            {
                return;
            }
            if (TextEditorControl.TextEditorProperties.MouseWheelScrollDown)
            {
                scrollDistance = -scrollDistance;
            }
            int newValue = _vScrollBar.Value + _vScrollBar.SmallChange * scrollDistance;

            _vScrollBar.Value = Math.Max(_vScrollBar.Minimum, Math.Min(_vScrollBar.Maximum - _vScrollBar.LargeChange + 1, newValue));
        }
        public void HandleMouseWheel(MouseEventArgs e)
        {
            var scrollDistance = mouseWheelHandler.GetScrollAmount(e);

            if (scrollDistance == 0)
            {
                return;
            }
            if (control.TextEditorProperties.MouseWheelScrollDown)
            {
                scrollDistance = -scrollDistance;
            }
            var newValue = vScrollBar.Value + vScrollBar.SmallChange * scrollDistance;

            vScrollBar.Value = Math.Max(vScrollBar.Minimum, Math.Min(vScrollBar.Maximum - vScrollBar.LargeChange + 1, newValue));
        }
Beispiel #4
0
 public void HandleMouseWheel(MouseEventArgs e)
 {
     if (DataProvider != null && DataProvider.InsightDataCount > 0)
     {
         var distance = mouseWheelHandler.GetScrollAmount(e);
         if (control.TextEditorProperties.MouseWheelScrollDown)
         {
             distance = -distance;
         }
         if (distance > 0)
         {
             CurrentData = (CurrentData + 1) % DataProvider.InsightDataCount;
         }
         else if (distance < 0)
         {
             CurrentData = (CurrentData + DataProvider.InsightDataCount - 1) % DataProvider.InsightDataCount;
         }
         Refresh();
     }
 }
Beispiel #5
0
        public void HandleMouseWheel(MouseEventArgs e)
        {
            var scrollDistance = mouseWheelHandler.GetScrollAmount(e);

            if (scrollDistance == 0)
            {
                return;
            }
            if (ModifierKeys.HasFlag(Keys.Control) && TextEditorProperties.MouseWheelTextZoom)
            {
                if (scrollDistance > 0)
                {
                    motherTextEditorControl.Font = new Font(
                        motherTextEditorControl.Font.Name,
                        motherTextEditorControl.Font.Size + 1);
                }
                else
                {
                    motherTextEditorControl.Font = new Font(
                        motherTextEditorControl.Font.Name,
                        Math.Max(6, motherTextEditorControl.Font.Size - 1));
                }
            }
            else
            {
                if (TextEditorProperties.MouseWheelScrollDown)
                {
                    scrollDistance = -scrollDistance;
                }
                if (ModifierKeys.HasFlag(Keys.Shift))
                {
                    var newValue = HScrollBar.Value + HScrollBar.SmallChange * scrollDistance;
                    HScrollBar.Value = Math.Max(HScrollBar.Minimum, Math.Min(HScrollBar.Maximum - HScrollBar.LargeChange + 1, newValue));
                }
                else
                {
                    var newValue = VScrollBar.Value + VScrollBar.SmallChange * scrollDistance;
                    VScrollBar.Value = Math.Max(VScrollBar.Minimum, Math.Min(VScrollBar.Maximum - VScrollBar.LargeChange + 1, newValue));
                }
            }
        }
Beispiel #6
0
 void ScrollableWheel(object sender, MouseEventArgs e)
 {
     ScrollBy(mouseWheelHandler.GetScrollAmount(e) * -16);
 }