public static void SetScrollPosition(IntPtr hwnd, ScrollbarDirection direction, int position) { //move the scroll bar SetScrollPos(hwnd, (int)direction, position, true); //convert the position to the windows message equivalent IntPtr msgPosition = new IntPtr((position << 16) + 4); Messages msg = (direction == ScrollbarDirection.Horizontal) ? Messages.WM_HSCROLL : Messages.WM_VSCROLL; SendMessage(hwnd, (int)msg, msgPosition, IntPtr.Zero); }
public static int GetScrollPosition(IntPtr hWnd, ScrollbarDirection direction) { return(GetScrollPos(hWnd, (int)direction)); }