コード例 #1
0
        private void RaiseScrollHEvent(IntPtr handle)
        {
            ScrollInfoStruct si = new ScrollInfoStruct();

            si.fMask  = NativeMethods.SIF_ALL;
            si.cbSize = Marshal.SizeOf(si);

            NativeMethods.GetScrollInfo(handle, NativeMethods.SB_HORZ, ref si);

            ScrollEventArgs e = new ScrollEventArgs();

            e.ScrollInfo = si;

            OnScrollH(e);
        }
コード例 #2
0
        /// <summary>
        /// Scroll to a vertical position
        /// </summary>
        /// <param name="e"></param>
        public void ScrollToPositionH(ScrollInfoStruct si)
        {
            ScrollInfoStruct siOwn = new ScrollInfoStruct();

            siOwn.fMask  = NativeMethods.SIF_ALL;
            siOwn.cbSize = Marshal.SizeOf(si);

            NativeMethods.GetScrollInfo(this.Handle, NativeMethods.SB_HORZ, ref siOwn);

            if (siOwn.nPos != si.nPos)
            {
                NativeMethods.SetScrollInfo(this.Handle.ToInt32(), NativeMethods.SB_HORZ, ref si, true);
                NativeMethods.SendMessageLong(this.Handle.ToInt32(), NativeMethods.WM_HSCROLL,
                                              NativeMethods.SB_THUMBTRACK + 0x10000 * si.nPos, 0);
            }
        }
コード例 #3
0
 internal static extern int SetScrollInfo(int hWnd, int n,
                                          [MarshalAs(UnmanagedType.Struct)] ref ScrollInfoStruct lpcScrollInfo,
                                          bool b);
コード例 #4
0
 internal static extern int GetScrollInfo(IntPtr hWnd, int n,
                                          ref ScrollInfoStruct lpScrollInfo);