Esempio n. 1
0
 public DetailsListView()
 {
     AllowColumnReorder = true;
     Dock = DockStyle.Fill;
     FullRowSelect = true;
     HideSelection = false;
     Location = new Point(0, 0);
     Margin = new Padding(0);
     Name = string.Format("CList{0}", Environment.TickCount);
     ShowItemToolTips = true;
     Size = new Size(380, 260);
     UseCompatibleStateImageBehavior = false;
     View = View.Details;
     OwnerDraw = true;
     VirtualMode = true;
     AllowDrop = true;
     View = View.Details;
     FullRowSelect = true;
     HideSelection = false;
     DoubleBuffered = true;
     _scrollInfo = new SCROLLINFO
         {
             cbSize = (uint)Marshal.SizeOf(_scrollInfo),
             fMask = (uint)ScrollInfoMask.SIF_POS
         };
 }
Esempio n. 2
0
        private SCROLLINFO GetScrollInfoStruct(RichTextBox tbb)
        {
            SCROLLINFO SCInfo = new SCROLLINFO();

            SCInfo.cbSize = (uint)Marshal.SizeOf(SCInfo);     //この2行は必須
            SCInfo.fMask = (int)ScrollInfoMask.SIF_ALL;

            GetScrollInfo(tbb.Handle, (int)ScrollBarDirection.SB_VERT, ref SCInfo);
            return SCInfo;
        }
Esempio n. 3
0
        private bool ScrolledToBottom()
        {
            Scroll = new SCROLLINFO();
            Scroll.size = Convert.ToUInt32(Marshal.SizeOf(Scroll));
            Scroll.mask = 7;

            if (!GetScrollInfo(Handle, 1, ref Scroll))
                return true;
            return (Scroll.page == 0) || ((Scroll.page + Scroll.position) >= Scroll.max);
        }
Esempio n. 4
0
        private bool IsEndOfScroll()
        {
            SCROLLINFO SCInfo = new SCROLLINFO();

            SCInfo.cbSize = (uint)Marshal.SizeOf(SCInfo);     //この2行は必須
            SCInfo.fMask  = (int)ScrollInfoMask.SIF_ALL;

            GetScrollInfo(rTextBoxOut.Handle, (int)ScrollBarDirection.SB_VERT, ref SCInfo);
            if (SCInfo.nPos >= SCInfo.nMax - Math.Max(SCInfo.nPage, 0))
            {
                return true;
            }
            return false;
        }
Esempio n. 5
0
        public void SetScrollBar(int Position, uint Page, int nMin, int nMax, out int TrackPosition)
        {
            SCROLLINFO VScrInfo = new SCROLLINFO();
            GetScrollInfo(this.Handle, (int)ScrollBarDirection.SB_HORZ, ref VScrInfo);
            VScrInfo.cbSize = (uint)Marshal.SizeOf(VScrInfo);
            VScrInfo.nPos = Position;
            VScrInfo.nPage = Page;
            VScrInfo.nMin = nMin;
            VScrInfo.nMax = nMax;
            TrackPosition = VScrInfo.nTrackPos;

            VScrInfo.fMask = (int)ScrollInfoMask.SIF_POS + (int)ScrollInfoMask.SIF_PAGE
              + (int)ScrollInfoMask.SIF_RANGE + (int)ScrollInfoMask.SIF_DISABLENOSCROLL;
            SetScrollInfo(this.Handle, (int)ScrollBarDirection.SB_HORZ, ref VScrInfo, true);
        }
		public bool GetScrollPosition(out int ScrollY)
		{
			SCROLLINFO ScrollInfo = new SCROLLINFO();
			ScrollInfo.cbSize = Marshal.SizeOf(ScrollInfo);
			ScrollInfo.fMask = SIF_ALL;
			if(GetScrollInfo(Handle, SB_VERT, ScrollInfo) == 0)
			{
				ScrollY = 0;
				return false;
			}
			else
			{
				ScrollY = ScrollInfo.nPos;
				return true;
			}
		}
Esempio n. 7
0
 public void Scroll(int pixels)
 {
     var si = new SCROLLINFO();
     si.cbSize = (uint)Marshal.SizeOf(si);
     si.fMask = (uint)ScrollInfoMask.SIF_ALL;
     GetScrollInfo(Handle, (int)ScrollBarDirection.SB_VERT, ref si);
     si.nPos += pixels;
     if (si.nPos < 0)
     {
         si.nPos = 0; // stop scrolling from wrapping around at the top
     }
     SetScrollInfo(Handle, (int)ScrollBarDirection.SB_VERT, ref si, true);
     var ptrWparam = new IntPtr(SB_THUMBTRACK + 0x10000 * si.nPos);
     var ptrLparam = new IntPtr(0);
     SendMessage(Handle, WM_VSCROLL, ptrWparam, ptrLparam);
 }
Esempio n. 8
0
        // Workaround for only partially visible list view items
        /* public static void EnsureVisible(ListView lv, int nIndex, bool bPartialOK)
        {
            Debug.Assert(lv != null); if(lv == null) return;
            Debug.Assert(nIndex >= 0); if(nIndex < 0) return;
            Debug.Assert(nIndex < lv.Items.Count); if(nIndex >= lv.Items.Count) return;

            int nPartialOK = (bPartialOK ? 1 : 0);
            try
            {
                NativeMethods.SendMessage(lv.Handle, LVM_ENSUREVISIBLE,
                    new IntPtr(nIndex), new IntPtr(nPartialOK));
            }
            catch(Exception) { Debug.Assert(false); }
        } */
        public static int GetScrollPosY(IntPtr hWnd)
        {
            try
            {
                SCROLLINFO si = new SCROLLINFO();
                si.cbSize = (uint)Marshal.SizeOf(si);
                si.fMask = (uint)ScrollInfoMask.SIF_POS;

                if(GetScrollInfo(hWnd, (int)ScrollBarDirection.SB_VERT, ref si))
                    return si.nPos;

                Debug.Assert(false);
            }
            catch(Exception) { Debug.Assert(false); }

            return 0;
        }
Esempio n. 9
0
        public unsafe static int SetScrollInfo(WindowHandle window, ScrollBar scrollBar, ref SCROLLINFO scrollInfo, bool redraw)
        {
            scrollInfo.cbSize = (uint)sizeof(SCROLLINFO);
            int result = Imports.SetScrollInfo(window, scrollBar, ref scrollInfo, redraw);

            return(result);
        }
Esempio n. 10
0
 static extern int SetScrollInfo(IntPtr hwnd, ScrollBarType fnBar, SCROLLINFO lpsi, bool fRedraw);
Esempio n. 11
0
 public unsafe static void GetScrollInfo(WindowHandle window, ScrollBar scrollBar, ref SCROLLINFO scrollInfo)
 {
     scrollInfo.cbSize = (uint)sizeof(SCROLLINFO);
     if (!Imports.GetScrollInfo(window, scrollBar, ref scrollInfo))
     {
         throw Errors.GetIoExceptionForLastError();
     }
 }
Esempio n. 12
0
        void scrollHoz(IntPtr handle, int pixels)
        {
            scrollLB(handle);

            //ShowScrollBar(handle, (int)ScrollBarDirection.SB_HORZ, (bool)false);

            // Get current scroller posion

            SCROLLINFO si = new SCROLLINFO();
            si.cbSize = (uint)Marshal.SizeOf(si);
            si.fMask = (uint)ScrollInfoMask.SIF_ALL;
            GetScrollInfo(handle, (int)ScrollBarDirection.SB_HORZ, ref si);

            // Increase posion by pixles
            si.nPos += pixels;
            if (si.nPos > (si.nMax - si.nPage) * 1.5) si.nPos = (int)((si.nMax - si.nPage) * 1.5);
            if (si.nPos < 0) si.nPos = 0;

            /*
            if (si.nPos < (si.nMax - si.nPage))
                si.nPos += pixels;
            else
            {
                SendMessage(handle, WM_HSCROLL, (IntPtr)ScrollBarCommands.SB_PAGERIGHT, IntPtr.Zero);
            }
             */

            // Reposition scroller
            SetScrollInfo(handle, (int)ScrollBarDirection.SB_HORZ, ref si, true);

            // Send a WM_HSCROLL scroll message using SB_THUMBTRACK as wParam
            // SB_THUMBTRACK: low-order word of wParam, si.nPos high-order word of wParam
            SendMessage(handle, WM_HSCROLL, (IntPtr)(ScrollBarCommands.SB_THUMBTRACK + 0x10000 * si.nPos), IntPtr.Zero);
        }
Esempio n. 13
0
 public static extern bool GetScrollInfo(IntPtr hWnd, int fnBar, SCROLLINFO si);
Esempio n. 14
0
 public static extern int SetScrollInfo(IntPtr hwnd, int bar, ref SCROLLINFO si, int fRedraw);
Esempio n. 15
0
        // Scrolls a given textbox. handle: an handle to our textbox. pixels: number of pixels to scroll.
        long scroll(IntPtr handle, int pixels)
        {
            long pixelsToEnd = 0;
            IntPtr ptrLparam = new IntPtr(0);
            IntPtr ptrWparam;
            // Get current scroller posion
            
            SCROLLINFO si = new SCROLLINFO();
            si.cbSize = (uint)Marshal.SizeOf(si);
            si.fMask = (uint)ScrollInfoMask.SIF_ALL;
            GetScrollInfo(handle, (int)ScrollBarDirection.SB_VERT, ref si);           

            // Increase posion by pixles
            pixelsToEnd = (si.nMax - si.nPage) - (si.nPos + pixels);
            if (si.nPos < (si.nMax - si.nPage))
                si.nPos += pixels;
            else
            {
                ptrWparam = new IntPtr(SB_ENDSCROLL);
                t.Enabled = false;
                SendMessage(handle, WM_VSCROLL, ptrWparam, ptrLparam);                
            }
                        
            // Reposition scroller
            SetScrollInfo(handle, (int)ScrollBarDirection.SB_VERT, ref si, true);

            // Send a WM_VSCROLL scroll message using SB_THUMBTRACK as wParam
            // SB_THUMBTRACK: low-order word of wParam, si.nPos high-order word of wParam
            ptrWparam = new IntPtr(SB_THUMBTRACK + 0x10000 * si.nPos);            
            SendMessage(handle, WM_VSCROLL, ptrWparam, ptrLparam);
            return pixelsToEnd;
        }
Esempio n. 16
0
 public extern static bool GetScrollInfo(IntPtr hWnd, ScrollBarTypes fnBar, ref SCROLLINFO lpsi);
Esempio n. 17
0
 private static extern int SetScrollInfo(IntPtr hWnd, int fnBar, ref SCROLLINFO lpsi, bool fRedraw);
Esempio n. 18
0
 private static extern bool GetScrollInfo(IntPtr hwnd, SBOrientation fnBar,
                                          ref SCROLLINFO lpsi);
Esempio n. 19
0
 public static extern int SetScrollInfo(IntPtr hwnd, int bar, ref SCROLLINFO si, int fRedraw);
Esempio n. 20
0
 internal static extern int SetScrollInfo(IntPtr hwnd, int fnBar, [In] ref SCROLLINFO scrollInfo, bool fRedraw);
Esempio n. 21
0
        protected override void OnScroll(ScrollEventArgs se)
        {
            base.OnScroll(se);

            if (se.ScrollOrientation == ScrollOrientation.HorizontalScroll)
            {
                // Get the current scroll position
                SCROLLINFO ScrollInfo = new SCROLLINFO();
                ScrollInfo.cbSize = Marshal.SizeOf(ScrollInfo);
                ScrollInfo.fMask  = ScrollInfoMask.SIF_ALL;
                GetScrollInfo(Handle, ScrollBarType.SB_HORZ, ScrollInfo);

                // Get the new scroll position
                int TargetScrollPos = ScrollInfo.nPos;
                switch (se.Type)
                {
                case ScrollEventType.SmallDecrement:
                    TargetScrollPos = ScrollInfo.nPos - 1;
                    break;

                case ScrollEventType.SmallIncrement:
                    TargetScrollPos = ScrollInfo.nPos + 1;
                    break;

                case ScrollEventType.LargeDecrement:
                    TargetScrollPos = ScrollInfo.nPos - ScrollInfo.nPage;
                    break;

                case ScrollEventType.LargeIncrement:
                    TargetScrollPos = ScrollInfo.nPos + ScrollInfo.nPage;
                    break;

                case ScrollEventType.ThumbPosition:
                    TargetScrollPos = ScrollInfo.nTrackPos;
                    break;

                case ScrollEventType.ThumbTrack:
                    TargetScrollPos = ScrollInfo.nTrackPos;
                    break;
                }
                ScrollColumn = Math.Max(0, Math.Min(TargetScrollPos, ScrollInfo.nMax - ScrollInfo.nPage + 1));

                // Update the scroll bar if we're not tracking
                if (se.Type != ScrollEventType.ThumbTrack)
                {
                    ScrollInfo.fMask = ScrollInfoMask.SIF_POS;
                    ScrollInfo.nPos  = ScrollColumn;
                    SetScrollInfo(Handle, ScrollBarType.SB_HORZ, ScrollInfo, true);
                }

                Invalidate();
            }
            else if (se.ScrollOrientation == ScrollOrientation.VerticalScroll)
            {
                // Get the current scroll position
                SCROLLINFO ScrollInfo = new SCROLLINFO();
                ScrollInfo.cbSize = Marshal.SizeOf(ScrollInfo);
                ScrollInfo.fMask  = ScrollInfoMask.SIF_ALL;
                GetScrollInfo(Handle, ScrollBarType.SB_VERT, ScrollInfo);

                // Get the new scroll position
                int TargetScrollPos = ScrollInfo.nPos;
                switch (se.Type)
                {
                case ScrollEventType.SmallDecrement:
                    TargetScrollPos = ScrollInfo.nPos - 1;
                    break;

                case ScrollEventType.SmallIncrement:
                    TargetScrollPos = ScrollInfo.nPos + 1;
                    break;

                case ScrollEventType.LargeDecrement:
                    TargetScrollPos = ScrollInfo.nPos - ScrollLinesPerPage;
                    break;

                case ScrollEventType.LargeIncrement:
                    TargetScrollPos = ScrollInfo.nPos + ScrollLinesPerPage;
                    break;

                case ScrollEventType.ThumbPosition:
                    TargetScrollPos = ScrollInfo.nTrackPos;
                    break;

                case ScrollEventType.ThumbTrack:
                    TargetScrollPos = ScrollInfo.nTrackPos;
                    break;
                }

                // Try to move to the new scroll position
                UpdateVerticalScrollPosition(TargetScrollPos, ref ScrollInfo);

                // Update the new range as well
                if (se.Type == ScrollEventType.ThumbTrack)
                {
                    bTrackingScroll = true;
                }
                else
                {
                    // If we've just finished tracking, allow updating the range
                    ScrollInfo.nPos = ScrollLine;
                    if (bTrackingScroll)
                    {
                        ScrollInfo.fMask |= ScrollInfoMask.SIF_RANGE;
                        ScrollInfo.nMax   = Math.Max(Lines.Count, 1) - 1;
                        bTrackingScroll   = false;
                    }
                    SetScrollInfo(Handle, ScrollBarType.SB_VERT, ScrollInfo, true);
                }

                Invalidate();
            }
        }
Esempio n. 22
0
 static extern int GetScrollInfo(IntPtr hwnd, ScrollBarType fnBar, SCROLLINFO lpsi);
Esempio n. 23
0
        public int GetVScrollPos()
        {
            SCROLLINFO currentInfo = new SCROLLINFO();
            currentInfo.cbSize = Marshal.SizeOf(currentInfo);
            currentInfo.fMask = (int)ScrollInfoMask.SIF_ALL;

            if (GetScrollInfo(this.Handle, (int)ScrollBarDirection.SB_VERT, ref currentInfo) != 0)
                return currentInfo.nPos;
            //else {
            //Debug.WriteLine("Error getting scroll info");
            //prevScrollPos = 0;
            //}
            return 0;
        }
Esempio n. 24
0
        private void ProcessWMScroll(int fnBar, int nScrollCode)
        {
            int large_change;
            int small_change;
            ScrollOrientation orientation = new ScrollOrientation();

            switch (fnBar)
            {
            case SB_VERT:
                large_change = VScrollLargeChange;
                small_change = VScrollSmallChange;
                orientation  = ScrollOrientation.VerticalScroll;
                break;

            case SB_HORZ:
                large_change = HScrollLargeChange;
                small_change = HScrollSmallChange;
                orientation  = ScrollOrientation.HorizontalScroll;
                break;

            default:
                throw new ArgumentOutOfRangeException("fnBar");
            }

            SCROLLINFO si = new SCROLLINFO();

            unsafe {
                si.cbSize = sizeof(SCROLLINFO);
                si.fMask  = SIF_ALL;
                GetScrollInfo(Handle, fnBar, new IntPtr(&si));
            }
            int oldValue = si.nPos;

            ScrollEventType type     = new ScrollEventType();
            int             newValue = si.nPos;

            switch (nScrollCode)
            {
            case SB_TOP:
                //case SB_LEFT:
                type     = ScrollEventType.First;
                newValue = si.nMin;
                break;

            case SB_BOTTOM:
                //case SB_RIGHT:
                type     = ScrollEventType.Last;
                newValue = si.nMax;
                break;

            case SB_LINEUP:
                //case SB_LINELEFT:
                type      = ScrollEventType.SmallDecrement;
                newValue -= small_change;
                break;

            case SB_LINEDOWN:
                //case SB_LINERIGHT:
                type      = ScrollEventType.SmallIncrement;
                newValue += small_change;
                break;

            case SB_PAGEUP:
                //case SB_PAGELEFT:
                type      = ScrollEventType.LargeDecrement;
                newValue -= large_change;
                break;

            case SB_PAGEDOWN:
                //case SB_PAGERIGHT:
                type      = ScrollEventType.LargeIncrement;
                newValue += large_change;
                break;

            case SB_THUMBPOSITION:
                type     = ScrollEventType.ThumbPosition;
                newValue = si.nTrackPos;
                break;

            case SB_THUMBTRACK:
                type     = ScrollEventType.ThumbTrack;
                newValue = si.nTrackPos;
                break;

            case SB_ENDSCROLL:
                type = ScrollEventType.EndScroll;
                break;

            default:
                throw new ArgumentOutOfRangeException("nScrollCode");
            }

            Point newPosition = scrollPosition;

            switch (orientation)
            {
            case ScrollOrientation.VerticalScroll:
                newPosition.Y = newValue;
                break;

            case ScrollOrientation.HorizontalScroll:
                newPosition.X = newValue;
                break;
            }
            ScrollWindowCore(newPosition);

            ScrollEventArgs se = new ScrollEventArgs(type, oldValue, newValue, orientation);

            OnScroll(se);
        }
Esempio n. 25
0
 private static extern int GetScrollInfo(IntPtr hWnd, ScrollBarDirection fnBar, ref SCROLLINFO lpsi);
 private static extern int GetScrollInfo(IntPtr hwnd, int fnBar, SCROLLINFO lpsi);
Esempio n. 27
0
        private void SetScrollBar()
        {
            SCROLLINFO si = new SCROLLINFO();
            si.cbSize = (uint)Marshal.SizeOf(si);
            si.fMask = SIF_ALL;
            int r = GetScrollInfo(this.txtContent.Handle, SB_VERT, ref si);
            pageLine = (int)si.nPage;
            this._vScrollBar1.LargeChange = pageLine;

            if (si.nMax >= si.nPage)
            {
                this._vScrollBar1.Visible = true;
                this._vScrollBar1.Maximum = si.nMax;
                this._vScrollBar1.Value = si.nPos;
            }
            else
                this._vScrollBar1.Visible = false;
        }
 private static extern int SetScrollInfo(IntPtr hwnd, int fnBar, SCROLLINFO lpsi, int Redraw);
 private SCROLLINFO GetScroll()
 {
     SCROLLINFO si = new SCROLLINFO();
     si.cbSize = Marshal.SizeOf(si);
     si.fMask = SIF_PAGE | SIF_POS | SIF_RANGE;
     GetScrollInfo(this.Handle, SB_VERT, ref si);
     return si;
 }
Esempio n. 30
0
 private static extern bool GetScrollInfo(HandleRef hWnd, int fnBar, SCROLLINFO si);
Esempio n. 31
0
 private static extern bool GetScrollInfo(IntPtr hwnd, int fnBar, ref SCROLLINFO lpsi);
 public static extern int SetScrollInfo(IntPtr hwnd, int bar, [MarshalAs(UnmanagedType.LPStruct)] SCROLLINFO scrollInfo, bool redraw);
Esempio n. 33
0
 public static extern int GetScrollInfo(int hwnd, int n, ref SCROLLINFO lpScrollInfo);
Esempio n. 34
0
 public static extern Boolean GetScrollInfo(IntPtr hWnd, Int32 fnBar, SCROLLINFO scrollInfo);
Esempio n. 35
0
 public static partial int SetScrollInfo(IntPtr hWnd, SB nBar, ref SCROLLINFO lpsi, BOOL redraw);
Esempio n. 36
0
 internal static extern int GetScrollInfo(IntPtr hwnd, int nBar, ref SCROLLINFO scrollInfo);
Esempio n. 37
0
 private static extern bool GetScrollInfo(IntPtr handle, int bar, ref SCROLLINFO info);
Esempio n. 38
0
 public static extern bool GetScrollInfo(IntPtr hWnd, int fnBar, SCROLLINFO si);
Esempio n. 39
0
        /// <summary>
        /// Vertically scroll to an absolute position.
        /// </summary>
        /// <param name="scrollPos">The position to scroll to.</param>
        public void SetVScrollPos(int scrollPos)
        {
            int prevScrollPos = 0;
            SCROLLINFO currentInfo = new SCROLLINFO();
            currentInfo.cbSize = Marshal.SizeOf(currentInfo);
            currentInfo.fMask = (int)ScrollInfoMask.SIF_ALL;

            if (GetScrollInfo(this.Handle, (int)ScrollBarDirection.SB_VERT, ref currentInfo) == 0)
            {
                //Debug.WriteLine("Error getting scroll info");
                prevScrollPos = scrollPos;
            }
            else
                prevScrollPos = currentInfo.nPos;

            //The LVM_SCROLL message will take a delta-x and delta-y which tell the list view how
            //much to scroll, relative to the current scroll positions. We are getting the scroll
            //position as an absolute position, so some adjustments are necessary:
            scrollPos -= prevScrollPos;
            //Send the LVM_SCROLL message to scroll the list view.
            SendMessage(new HandleRef(null, this.Handle), (uint)ListViewMessages.LVM_SCROLL, (IntPtr)0, (IntPtr)scrollPos);
        }
Esempio n. 40
0
 public static extern int GetScrollInfo(IntPtr hwnd, int bar, ref SCROLLINFO si);
Esempio n. 41
0
 public static extern int SetScrollInfo(IntPtr hWnd, int wBar, ref SCROLLINFO lpsi, bool fRedraw);
Esempio n. 42
0
 public static extern bool GetScrollInfo(HWND hwnd, int BarType, ref SCROLLINFO lpsi);
Esempio n. 43
0
 public static extern int SetScrollInfo(HandleRef hWnd, int fnBar, SCROLLINFO si, bool redraw);
Esempio n. 44
0
 public static extern int SetScrollInfo(HWND hwnd, int fnBar, ref SCROLLINFO lpsi, bool fRedraw);
Esempio n. 45
0
 public static extern int GetScrollInfo(IntPtr hwnd, int bar, ref SCROLLINFO si);
Esempio n. 46
0
 public static extern bool GetScrollInfo
 (
     IntPtr hwnd,
     int fnBar,
     SCROLLINFO lpcScrollInfo
 );
Esempio n. 47
0
 //文本框大小改变
 private void txtContent_SizeChanged(object sender, EventArgs e)
 {
     SCROLLINFO si = new SCROLLINFO();
     si.cbSize = (uint)Marshal.SizeOf(si);
     si.fMask = SIF_ALL;
     int r = GetScrollInfo(this.txtContent.Handle, SB_VERT, ref si);
     pageLine = (int)si.nPage;
     _timer1.Enabled = true;
     ShowRow();
 }
Esempio n. 48
0
 public static extern int SetScrollInfo(IntPtr hwnd, int fnBar, [In] ref SCROLLINFO lpsi, bool fRedraw);
 private static extern int SetScrollInfo(IntPtr hWnd, int fnBar, ref SCROLLINFO lpsi, bool fRedraw);
Esempio n. 50
0
 public static extern int SetScrollInfo(HandleRef hwnd, int fnBar, [In] SCROLLINFO lpsi, bool fRedraw);
Esempio n. 51
0
 public static bool GetScrollInfo(Control ctrl, ref SCROLLINFO si, ScrollBarDirection scrollBarDirection)
 {
     if (ctrl != null)
     {
         si.cbSize = (uint)Marshal.SizeOf(si);
         si.fMask = (int)ScrollInfoMask.SIF_ALL;
         if (GetScrollInfo(ctrl.Handle, (int)scrollBarDirection, ref si))
             return true;
     }
     return false;
 }
Esempio n. 52
0
 private static extern bool GetScrollInfo(IntPtr hwnd, int fnBar, ref SCROLLINFO lpsi);
Esempio n. 53
0
        /// <summary>
        /// Get the scroll position of the given scroll bar
        /// </summary>
        /// <param name="lv"></param>
        /// <param name="horizontalBar"></param>
        /// <returns></returns>
        public static int GetScrollPosition(ListView lv, bool horizontalBar) {
            int fnBar = (horizontalBar ? SB_HORZ : SB_VERT);

            SCROLLINFO scrollInfo = new SCROLLINFO();
            scrollInfo.fMask = SIF_POS;
            if (GetScrollInfo(lv.Handle, fnBar, scrollInfo))
                return scrollInfo.nPos;
            else
                return -1;
        }
Esempio n. 54
0
 private static extern int GetScrollInfo(IntPtr hWnd, ScrollBarDirection fnBar, ref SCROLLINFO lpsi);
Esempio n. 55
0
 public void GetScrollPosition(out int min, out int max, out int pos, out int smallchange, out int largechange)
 {
     SCROLLINFO scrollinfo = new SCROLLINFO();
     scrollinfo.cbSize = (uint)Marshal.SizeOf(typeof(SCROLLINFO));
     scrollinfo.fMask = (int)ScrollInfoMask.SIF_ALL;
     if (GetScrollInfo(this.Handle, (int)SBTYPES.SB_VERT, ref scrollinfo))
     {
         min = scrollinfo.nMin;
         max = scrollinfo.nMax;
         pos = scrollinfo.nPos;
         smallchange = 1;
         largechange = (int)scrollinfo.nPage;
     }
     else
     {
         min = 0;
         max = 0;
         pos = 0;
         smallchange = 0;
         largechange = 0;
     }
 }
Esempio n. 56
0
 private static extern bool GetScrollInfo([In] IntPtr hwnd, [In] int fnBar, [In, Out] ref SCROLLINFO lpsi);
Esempio n. 57
0
        /// <summary>
        /// Get the scroll position of the given scroll bar
        /// </summary>
        /// <param name="handle"></param>
        /// <param name="horizontalBar"></param>
        /// <returns></returns>
        public static int GetScrollPosition(ObjectListView objectListView, bool horizontalBar)
        {
            int fnBar = (horizontalBar ? SB_HORZ : SB_VERT);

            SCROLLINFO si = new SCROLLINFO();
            si.fMask = SIF_POS;
            if (GetScrollInfo(objectListView.Handle, fnBar, si))
                return si.nPos;
            else
                return -1;
        }
Esempio n. 58
0
 public static extern int SetScrollInfo(HandleRef hWnd, int fnBar, SCROLLINFO si, bool redraw);
Esempio n. 59
0
 public static extern bool GetScrollInfo(HandleRef hwnd, int fnBar, SCROLLINFO lpsi);
Esempio n. 60
0
 private static extern int GetScrollInfo(HandleRef hWnd, int fnBar, ref SCROLLINFO lpsi);