Exemplo n.º 1
0
 private static extern bool SetScrollInfo(IntPtr hwnd, int bar, ref ScrollInfo scrollInfo, int redraw);
Exemplo n.º 2
0
 public extern static int SetScrollInfo(IntPtr hWnd, int fnBar, ref ScrollInfo lpsi, bool bRedraw);
Exemplo n.º 3
0
    void UpdateTextBox(TextBox textBox, string value, bool preserveScroll) {
      scrollPreserve_[textBox.Handle] = preserveScroll;

      textBox.Text = value;

      int previousScroll;
      if (!scrollPositions_.TryGetValue(textBox.Handle, out previousScroll)) {
        previousScroll = 0;
      }
      var scrollInfo = new ScrollInfo();
      scrollInfo.cbSize = Marshal.SizeOf(scrollInfo);
      scrollInfo.fMask = (uint)ScrollInfoMask.SIF_TRACKPOS;
      scrollInfo.nTrackPos = previousScroll;
      SetScrollInfo(textBox.Handle, SB_VERT, ref scrollInfo, 1);

      var ptrWparam = new IntPtr(SB_THUMBPOSITION | previousScroll << 16);
      SendMessage(textBox.Handle, WM_VSCROLL, ptrWparam, IntPtr.Zero);
    }
Exemplo n.º 4
0
        public void ScrollToEnd()
        {
            if (Log.IsDebugEnabled) Log.Debug("ScrollToEnd");

            //NOTE: Following didn't work well enough.
            //SelectionStart = TextLength;
            //ScrollToCaret();

            // Get the current scroll info.
            ScrollInfo si = new ScrollInfo();
            si.Size = (uint) Marshal.SizeOf(si);
            si.Mask = (uint) ScrollInfoMask.All;
            GetScrollInfo(Handle, (int) ScrollBarDirection.Vertical, ref si);

            // Set the scroll position to maximum.
            si.Pos = si.Max - (int) si.Page;
            SetScrollInfo(Handle, (int) ScrollBarDirection.Vertical, ref si, true);
            SendMessage(Handle, VerticalScroll, new IntPtr(Thumbtrack + 0x10000 * si.Pos), new IntPtr(0));

            FollowTail = true;
        }
Exemplo n.º 5
0
 public AutoScrollHelper(GridView view)
 {
     fGrid = view.GridControl;
     fView = view;
     fScrollInfo = new ScrollInfo(this, view);
 }
        /// <summary>
        ///     Get current position
        /// </summary>
        /// <returns>SCROLLINFO</returns>
        public bool GetPosition(out ScrollInfo scrollInfo)
        {
            scrollInfo = ScrollInfo.Create(ScrollInfoMask.All);

            return(User32Api.GetScrollInfo(ScrollBarWindow.Handle, ScrollBarType, ref scrollInfo));
        }
Exemplo n.º 7
0
 public static extern bool GetScrollInfo(IntPtr hwnd, ScrollBarTypes scrollBar, ref ScrollInfo scrollInfo);
Exemplo n.º 8
0
 public static extern bool GetScrollInfo(int wnd, int bat,
                                         [In, Out] ScrollInfo si);
Exemplo n.º 9
0
 public AuScrollableControl()
 {
     _h.cbSize = _v.cbSize = Api.SizeOf(_h);
     _h.nMax   = _v.nMax = 100;
     _e        = new ScrollInfo();
 }
Exemplo n.º 10
0
		static extern int GetScrollInfo(IntPtr window,
			ScrollOrientation bar,
			out ScrollInfo info);
Exemplo n.º 11
0
 public static extern int SetScrollInfo(int wnd, int bar,
                                        ScrollInfo si, bool redraw);
Exemplo n.º 12
0
 private int SetColumnCount(ScrollInfo info)
 => _Columns = Math.Max((int)Math.Floor(info.ClientWidth / ItemWidth), 1);
Exemplo n.º 13
0
 private extern static int SetScrollInfo(IntPtr hWnd, int nBar, ref ScrollInfo Info, int bRedraw);
Exemplo n.º 14
0
 private extern static int GetScrollInfo(IntPtr hWnd, int nBar, ref ScrollInfo Info);
Exemplo n.º 15
0
 private static extern int SetScrollInfo(IntPtr hWnd, int nBar, ref ScrollInfo Info, int bRedraw);
Exemplo n.º 16
0
 private static extern bool GetScrollInfo(IntPtr hwnd, int fnBar, ref ScrollInfo lpsi);
 public AutoScrollHelper(LayoutView view)
 {
     fGrid       = view.GridControl;
     fView       = view;
     fScrollInfo = new ScrollInfo(this, view);
 }
Exemplo n.º 18
0
 void scaleZoomHelper_Scrolled(ScrollInfo scrollInfo)
 {
     _timeAxis.Zoom(
         scrollInfo.Delta < 0 ? 2 : 0.5,
         _onlineMode.IsOnline ? 1 : scrollInfo.RelativePosition);
 }
Exemplo n.º 19
0
 public static extern int GetScrollInfo(IntPtr hwnd, int nBar, ref ScrollInfo scrollInfo);
Exemplo n.º 20
0
 public static extern bool GetScrollInfo(IntPtr hWnd, int n, ref ScrollInfo lpScrollInfo);
Exemplo n.º 21
0
 public static extern bool SetScrollInfo(IntPtr hwnd, ScrollBarTypes scrollBar, ref ScrollInfo scrollInfo, bool redraw);
Exemplo n.º 22
0
        protected override LResult WindowProcedure(WindowHandle window, MessageType message, WParam wParam, LParam lParam)
        {
            ScrollInfo si;

            switch (message)
            {
            case MessageType.Size:
                int iMaxWidth = 40 * cxChar + 22 * cxCaps;

                cxClient = lParam.LowWord;
                cyClient = lParam.HighWord;

                // Set vertical scroll bar range and page size
                si = new ScrollInfo
                {
                    Mask = ScrollInfoMask.Range | ScrollInfoMask.Page,
                    Min  = 0,
                    Max  = Metrics.SystemMetrics.Count - 1,
                    Page = (uint)(cyClient / cyChar),
                };
                window.SetScrollInfo(ScrollBar.Vertical, ref si, true);

                // Set horizontal scroll bar range and page size
                si.Max  = 2 + iMaxWidth / cxChar;
                si.Page = (uint)(cxClient / cxChar);
                window.SetScrollInfo(ScrollBar.Horizontal, ref si, true);

                return(0);

            case MessageType.VerticalScroll:
                // Get all the vertical scroll bar information
                si = new ScrollInfo
                {
                    Mask = ScrollInfoMask.All
                };
                window.GetScrollInfo(ScrollBar.Vertical, ref si);

                // Save the position for comparison later on
                int iVertPos = si.Position;

                switch ((ScrollCommand)wParam.LowWord)
                {
                case ScrollCommand.Top:
                    si.Position = si.Min;
                    break;

                case ScrollCommand.Bottom:
                    si.Position = si.Max;
                    break;

                case ScrollCommand.LineUp:
                    si.Position -= 1;
                    break;

                case ScrollCommand.LineDown:
                    si.Position += 1;
                    break;

                case ScrollCommand.PageUp:
                    si.Position -= (int)si.Page;
                    break;

                case ScrollCommand.PageDown:
                    si.Position += (int)si.Page;
                    break;

                case ScrollCommand.ThumbTrack:
                    si.Position = si.TrackPosition;
                    break;
                }

                // Set the position and then retrieve it. Due to adjustments
                // by Windows it may not be the same as the value set.
                si.Mask = ScrollInfoMask.Position;
                window.SetScrollInfo(ScrollBar.Vertical, ref si, true);
                window.GetScrollInfo(ScrollBar.Vertical, ref si);

                // If the position has changed, scroll the window and update it
                if (si.Position != iVertPos)
                {
                    window.ScrollWindow(new Point(0, cyChar * (iVertPos - si.Position)));
                    window.UpdateWindow();
                }
                return(0);

            case MessageType.HorizontalScroll:
                // Get all the horizontal scroll bar information
                si = new ScrollInfo
                {
                    Mask = ScrollInfoMask.All
                };
                window.GetScrollInfo(ScrollBar.Horizontal, ref si);

                // Save the position for comparison later on
                int iHorzPos = si.Position;
                switch ((ScrollCommand)wParam.LowWord)
                {
                case ScrollCommand.LineLeft:
                    si.Position -= 1;
                    break;

                case ScrollCommand.LineRight:
                    si.Position += 1;
                    break;

                case ScrollCommand.PageLeft:
                    si.Position -= (int)si.Page;
                    break;

                case ScrollCommand.PageRight:
                    si.Position += (int)si.Page;
                    break;

                case ScrollCommand.ThumbPosition:
                    si.Position = si.TrackPosition;
                    break;
                }

                // Set the position and then retrieve it. Due to adjustments
                // by Windows it may not be the same as the value set.
                si.Mask = ScrollInfoMask.Position;
                window.SetScrollInfo(ScrollBar.Horizontal, ref si, true);
                window.GetScrollInfo(ScrollBar.Horizontal, ref si);

                // If the position has changed, scroll the window
                if (si.Position != iHorzPos)
                {
                    window.ScrollWindow(new Point(cxChar * (iHorzPos - si.Position), 0));
                }
                return(0);

            case MessageType.Paint:
                using (DeviceContext dc = window.BeginPaint(out PaintStruct ps))
                {
                    // Get vertical scroll bar position
                    si = new ScrollInfo
                    {
                        Mask = ScrollInfoMask.Position
                    };
                    window.GetScrollInfo(ScrollBar.Vertical, ref si);
                    iVertPos = si.Position;

                    // Get horizontal scroll bar position
                    window.GetScrollInfo(ScrollBar.Horizontal, ref si);
                    iHorzPos = si.Position;

                    // Find painting limits
                    int iPaintBeg = Math.Max(0, iVertPos + ps.Paint.Top / cyChar);
                    int iPaintEnd = Math.Min(Metrics.SystemMetrics.Count - 1, iVertPos + ps.Paint.Bottom / cyChar);

                    var keys = Metrics.SystemMetrics.Keys.ToArray();
                    for (int i = iPaintBeg; i <= iPaintEnd; i++)
                    {
                        var metric = keys[i];
                        int x      = cxChar * (1 - iHorzPos);
                        int y      = cyChar * (i - iVertPos);

                        dc.TextOut(new Point(x, y), metric.ToString().AsSpan());
                        dc.TextOut(new Point(x + 22 * cxCaps, y), Metrics.SystemMetrics[metric].AsSpan());
                        dc.SetTextAlignment(new TextAlignment(TextAlignment.Horizontal.Right, TextAlignment.Vertical.Top));
                        dc.TextOut(new Point(x + 22 * cxCaps + 40 * cxChar, y), Windows.GetSystemMetrics(metric).ToString().AsSpan());
                        dc.SetTextAlignment(new TextAlignment(TextAlignment.Horizontal.Left, TextAlignment.Vertical.Top));
                    }
                }
                return(0);
            }

            return(base.WindowProcedure(window, message, wParam, lParam));
        }
Exemplo n.º 23
0
 static extern bool GetScrollInfo(IntPtr hWnd, int scrollDirection, ref ScrollInfo si);
 public static extern bool GetScrollInfo(IntPtr hWnd, int nBar, ref ScrollInfo lpScrollInfo);
Exemplo n.º 25
0
 public extern static int GetScrollInfo(IntPtr hWnd, int fnBar, ref ScrollInfo lpsi);
 public static extern bool SetScrollInfo(int hwnd, int nBar, ref ScrollInfo lpcScrollInfo, bool redraw);
Exemplo n.º 27
0
 void UpdateScrollStates() {
   foreach (var handle in scrollPreserve_.Keys) {
     if (scrollPreserve_[handle]) {
       var scrollInfo = new ScrollInfo();
       scrollInfo.cbSize = Marshal.SizeOf(scrollInfo);
       scrollInfo.fMask = (uint)ScrollInfoMask.SIF_TRACKPOS;
       bool hasScrollInfo = GetScrollInfo(handle, SB_VERT, ref scrollInfo);
       scrollPositions_[handle] = scrollInfo.nTrackPos;
     }
   }
 }
 public static extern int SetScrollInfo(IntPtr hwnd, int nBar, ref ScrollInfo lpcScrollInfo, bool redraw);
Exemplo n.º 29
0
 private static extern bool GetScrollInfo(IntPtr hwnd, int bar, ref ScrollInfo scrollInfo);
 public InvertedVCrkScrollBar(ScrollInfo info) : base(info)
 {
 }
Exemplo n.º 31
0
 private static extern int GetScrollInfo(IntPtr hWnd, int nBar, ref ScrollInfo Info);
Exemplo n.º 32
0
 public static extern int GetScrollInfo(IntPtr hWnd, int n, ref ScrollInfo lpScrollInfo);
Exemplo n.º 33
0
 public static ScrollInfo Create(uint uiMask)
 {
     ScrollInfo Info = new ScrollInfo();
     Info.cbSize = (uint)Marshal.SizeOf(typeof(ScrollInfo));
     Info.fMask = uiMask;
     return Info;
 }
Exemplo n.º 34
0
 public static extern int SetScrollInfo(IntPtr hwnd, int fnBar, [In] ref ScrollInfo lpsi, bool fRedraw);