Exemple #1
0
        private void ScrollVisible(int index, int deltaY)
        {
            int visibleY = Math.Max(0, index - _location.Y);

            if (visibleY <= _visibleCount)
            {
                Rectangle visible = DisplayRectangle;
                RECT      scroll  = UnsafeUtilities.RECTFromLTRB(visible.X, visibleY * _rowHeight, visible.Right, Math.Max(visible.Bottom, visible.Bottom + _rowHeight));
                RECT      clip    = UnsafeUtilities.RECTFromRectangle(visible);
                UnsafeNativeMethods.ScrollWindowEx(this.Handle, 0, deltaY * _rowHeight, ref scroll, ref clip, IntPtr.Zero, IntPtr.Zero, 2 /* SW_INVALIDATE */ | 4 /* SW_ERASE */);
            }
        }