protected void UpdateVScrollBar()
        {
            ScrollInfo.VScrollVisible = scrollStrategy.IsNeededVScrollBar(this.Grid.DisplayRectangle.Height);

            {
                int n = scrollStrategy.GetVScrollLargeChange((int)Grid.ViewInfo.ViewRects.Client.Height);
                if (n < 1)
                {
                    n = 1;
                }
                ScrollArgs args = new ScrollArgs();
                args.Maximum     = Math.Max(0, Grid.NotFixedRows.Count);
                args.Value       = TopVisibleRowIndex + 1;
                args.LargeChange = n;
                if (!args.IsEquals(ScrollInfo.VScrollArgs))
                {
                    args.AssignTo(ScrollInfo.VScroll);
                }
            }
        }
예제 #2
0
        protected override void UpdateDXScrollBar(bool isHorz)
        {
            if (IsLockUpdate)
            {
                return;
            }
            ScrollBarBase dxScroll = isHorz ? (ScrollBarBase)HScroll : (ScrollBarBase)VScroll;

            if (SourceControl == null)
            {
                return;
            }
            if (!SourceControl.IsHandleCreated || !dxScroll.Parent.IsHandleCreated)
            {
                dxScroll.Visible = false;
                return;
            }
            BeginUpdate();
            try
            {
                SCROLLBARINFO sbInfo = new SCROLLBARINFO();
                sbInfo.Init();
                SCROLLBARINFO.GetScrollBarInfo(SourceControl.Handle, isHorz ? SCROLLBARINFO.OBJID_HSCROLL : SCROLLBARINFO.OBJID_VSCROLL, ref sbInfo);
                Rectangle scrollBounds = sbInfo.rcScrollBar.ToRectangle();
                if ((SourceControl != null && !SourceControl.Visible) || scrollBounds.IsEmpty || sbInfo.rgstate0 == SCROLLBARINFO.STATE_SYSTEM_INVISIBLE || sbInfo.rgstate0 == SCROLLBARINFO.STATE_SYSTEM_OFFSCREEN)
                {
                    dxScroll.Visible = false;
                    return;
                }
                scrollBounds = dxScroll.Parent.RectangleToClient(scrollBounds);

                if (isHorz)
                {
                    scrollBounds.Height = fWidth;
                }
                else
                {
                    scrollBounds.Width = fWidth;
                }
                dxScroll.Bounds = scrollBounds;
                ScrollArgs currentArgs = new ScrollArgs(dxScroll), args = new ScrollArgs();
                if (sbInfo.rgstate0 == SCROLLBARINFO.STATE_SYSTEM_UNAVAILABLE)
                {
                    args.Maximum = args.Minimum = 0;
                    args.Value   = 0;
                    args.Enabled = false;
                }
                else
                {
                    SCROLLINFO sInfo = new SCROLLINFO();
                    sInfo.Init();
                    SCROLLINFO.GetScrollInfo(SourceControl.Handle, isHorz ? SCROLLINFO.SB_HORZ : SCROLLINFO.SB_VERT, ref sInfo);
                    args.Enabled     = true;
                    args.Maximum     = sInfo.nMax;
                    args.Minimum     = sInfo.nMin;
                    args.LargeChange = sInfo.nPage;
                    args.SmallChange = isHorz ? 8 : 1;
                    args.Value       = sInfo.nTrackPos;
                }
                dxScroll.Visible = true;
                if (currentArgs.IsEquals(args))
                {
                    return;
                }
                args.AssignTo(dxScroll);
            }
            finally
            {
                EndUpdate();
            }
        }