示例#1
0
        void UpdateScroll()
        {
            GDI.SCROLLINFO si = new GDI.SCROLLINFO();
            si.cbSize = System.Runtime.InteropServices.Marshal.SizeOf(typeof(GDI.SCROLLINFO));

            si.fMask = (int)(GDI.ScrollInfoMask.SIF_RANGE | GDI.ScrollInfoMask.SIF_POS | GDI.ScrollInfoMask.SIF_PAGE);

            double xpc = (m_view.Left - m_physExtents.Left) / m_physExtents.Width;
            double wpc = m_view.Width / m_physExtents.Width;

            si.nPos  = (int)(xpc * ScrollScale);
            si.nMin  = 0;
            si.nMax  = (int)ScrollScale;
            si.nPage = (int)(wpc * ScrollScale);

            GDI.SetScrollInfo(Handle, (int)GDI.ScrollBarDirection.SB_HORZ, ref si, true);

            double ypc = (m_view.Top - m_physExtents.Top) / m_physExtents.Height;
            double hpc = m_view.Height / m_physExtents.Height;

            si.nPos  = (int)(ypc * ScrollScale);
            si.nMin  = 0;
            si.nMax  = (int)ScrollScale;
            si.nPage = (int)(hpc * ScrollScale);

            GDI.SetScrollInfo(Handle, (int)GDI.ScrollBarDirection.SB_VERT, ref si, true);
        }
示例#2
0
        void UpdateScroll()
        {
            GDI.SCROLLINFO si = new GDI.SCROLLINFO();
            si.cbSize = System.Runtime.InteropServices.Marshal.SizeOf(typeof(GDI.SCROLLINFO));

            si.fMask = (int)(GDI.ScrollInfoMask.SIF_RANGE | GDI.ScrollInfoMask.SIF_POS | GDI.ScrollInfoMask.SIF_PAGE);

            si.nPos  = (int)(m_view.Left - m_physExtents.Left);
            si.nMin  = 0;
            si.nMax  = (int)m_physExtents.Size.X;
            si.nPage = (int)m_view.Width;

            GDI.SetScrollInfo(Handle, (int)GDI.ScrollBarDirection.SB_HORZ, ref si, true);

            si.nPos  = (int)(m_view.Top - m_physExtents.Top);
            si.nMin  = 0;
            si.nMax  = (int)m_physExtents.Size.Y;
            si.nPage = (int)m_view.Height;

            GDI.SetScrollInfo(Handle, (int)GDI.ScrollBarDirection.SB_VERT, ref si, true);
        }