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

HorizontalScroll() protected method

Scrolls the contents of the Table horizontally to the specified value
protected HorizontalScroll ( int value ) : void
value int The value to scroll to
return void
        protected void HorizontalScroll(int value)
        {
            int scrollVal = this.hScrollBar.Value - value;

            if (scrollVal != 0)
            {
                RECT scrollRect = RECT.FromRectangle(this.PseudoClientRect);
                Rectangle invalidateRect = scrollRect.ToRectangle();

                NativeMethods.ScrollWindow(this.Handle, scrollVal, 0, ref scrollRect, ref scrollRect);

                if (scrollVal < 0)
                    invalidateRect.X = invalidateRect.Right + scrollVal;

                invalidateRect.Width = Math.Abs(scrollVal);

                this.Invalidate(invalidateRect, false);

                if (this.VScroll)
                {
                    this.Invalidate(new Rectangle(this.Width - this.BorderWidth - SystemInformation.VerticalScrollBarWidth,
                        this.Height - this.BorderWidth - SystemInformation.HorizontalScrollBarHeight,
                        SystemInformation.VerticalScrollBarWidth,
                        SystemInformation.HorizontalScrollBarHeight),
                        false);
                }
            }
        }
Table