Пример #1
0
        /// <summary>
        ///     Apply position from the scrollInfo
        /// </summary>
        /// <param name="scrollInfo">SCROLLINFO ref</param>
        /// <returns>bool</returns>
        private bool ApplyPosition(ref ScrollInfo scrollInfo)
        {
            if (ShowChanges)
            {
                User32Api.SetScrollInfo(ScrollBarWindow.Handle, ScrollBarType, ref scrollInfo, true);
            }
            switch (ScrollBarType)
            {
            case ScrollBarTypes.Horizontal:
                User32Api.SendMessage(ScrollingWindow.Handle, WindowsMessages.WM_HSCROLL, 4 + 0x10000 * scrollInfo.Position, 0);
                break;

            case ScrollBarTypes.Vertical:
            case ScrollBarTypes.Control:
                User32Api.SendMessage(ScrollingWindow.Handle, WindowsMessages.WM_VSCROLL, (int)((uint)ScrollBarCommands.SB_THUMBPOSITION + (scrollInfo.Position << 16)), 0);
                break;
            }
            return(true);
        }