XPTable.Models.Table.OnMouseWheel C# (CSharp) Method

OnMouseWheel() protected method

Raises the MouseWheel event
protected OnMouseWheel ( MouseEventArgs e ) : void
e MouseEventArgs A MouseEventArgs that contains the event data
return void
        protected override void OnMouseWheel(MouseEventArgs e)
        {
            base.OnMouseWheel(e);

            if (!this.Scrollable || (!this.HScroll && !this.VScroll))
            {
                return;
            }

            if (this.VScroll)
            {
                int newVal = this.vScrollBar.Value - ((e.Delta / 120) * SystemInformation.MouseWheelScrollLines);

                this.vScrollBar.Value = this.EnsureSafeVScrollValue(newVal);
            }
            else if (this.HScroll)
            {
                int newVal = this.hScrollBar.Value - ((e.Delta / 120) * Column.MinimumWidth);

                if (newVal < 0)
                {
                    newVal = 0;
                }
                else if (newVal > this.hScrollBar.Maximum - this.hScrollBar.LargeChange)
                {
                    newVal = this.hScrollBar.Maximum - this.hScrollBar.LargeChange;
                }

                this.HorizontalScroll(newVal);
                this.hScrollBar.Value = newVal;
            }
        }
Table