public void ResetLayout() { if (this.UseNewLayoutSystem) { this.InvalidateMeasure(); this.InvalidateArrange(); } else { IRadScrollViewport scrollViewport = this.viewport as IRadScrollViewport; if (scrollViewport != null) { scrollViewport.InvalidateViewport(); } if (this.viewport == null) { this.horizontalScrollBar.Visibility = ElementVisibility.Collapsed; this.verticalScrollBar.Visibility = ElementVisibility.Collapsed; return; } // Init size members (clientSize, viewportSize, extentSize) this.clientSize = this.Parent.FieldSize; Size preferredViewportSize = this.viewport.GetPreferredSize(this.clientSize); this.extentSize = this.UsePhysicalScrolling ? preferredViewportSize : ((IRadScrollViewport)this.viewport).GetExtentSize(); ScrollFlags sf = GetScrollingNeeds(this.extentSize, this.clientSize); Size scrollBarsSize = GetScrollBarsSize(sf); this.viewportSize = Size.Subtract(this.clientSize, scrollBarsSize); // Viewport Point startPoint = new Point(base.RightToLeft ? scrollBarsSize.Width : 0, 0); Rectangle viewportRect = new Rectangle(startPoint, this.UsePhysicalScrolling ? this.extentSize : this.viewportSize); this.viewport.SetBounds(viewportRect); ResetScrollState(sf); ResetScrollPos(); OnSizeHScroll(this.clientSize); OnSizeVScroll(this.clientSize); OnSizeBlankSpot(this.clientSize); } }
protected override SizeF ArrangeOverride(SizeF finalSize) { IRadScrollViewport scrollViewport = this.viewport as IRadScrollViewport; if (scrollViewport != null) { scrollViewport.InvalidateViewport(); } if (this.viewport == null) { base.ArrangeOverride(finalSize); this.horizontalScrollBar.Visibility = ElementVisibility.Collapsed; this.verticalScrollBar.Visibility = ElementVisibility.Collapsed; return(finalSize); } // Init size members (clientSize, viewportSize, extentSize) this.clientSize = Size.Round(finalSize); //TODO: //changed this.viewport.DesiziredSize to this.viewport.Size //MUST be tested Size preferredViewportSize = Size.Round(this.viewport.DesiredSize); this.extentSize = this.UsePhysicalScrolling ? preferredViewportSize : ((IRadScrollViewport)this.viewport).GetExtentSize(); ScrollFlags sf = GetScrollingNeeds(this.extentSize, this.clientSize); Size scrollBarsSize = GetScrollBarsSize(sf); this.viewportSize = Size.Subtract(this.clientSize, scrollBarsSize); // Sets Visibility and Enabled properties of the scrollbars and the blankspot ResetScrollState(sf); // !!! blankSpotSize is non-empty ONLY when both scrollbars are visible Size blankSpotSize = Size.Empty; if (this.BlankSpot.Visibility == ElementVisibility.Visible) { blankSpotSize = scrollBarsSize; } float viewportLeftPos = this.RightToLeft ? scrollBarsSize.Width : 0; float horizontalScrollLeftPos = this.RightToLeft ? scrollBarsSize.Width : 0; float verticalScrollLeftPos = this.RightToLeft ? 0 : finalSize.Width - scrollBarsSize.Width; float blankSpotLeftPos = this.RightToLeft ? 0 : finalSize.Width - blankSpotSize.Width; RectangleF viewportRect = new RectangleF( viewportLeftPos, 0, this.viewportSize.Width, this.viewportSize.Height); RectangleF vertScrollRect = new RectangleF( verticalScrollLeftPos, 0, scrollBarsSize.Width, Math.Max(0, finalSize.Height - scrollBarsSize.Height)); RectangleF horizScrollRect = new RectangleF( horizontalScrollLeftPos, finalSize.Height - scrollBarsSize.Height, Math.Max(0, finalSize.Width - scrollBarsSize.Width), scrollBarsSize.Height); RectangleF blankSpotRectRect = new RectangleF( blankSpotLeftPos, finalSize.Height - blankSpotSize.Height, blankSpotSize.Width, blankSpotSize.Height); this.viewport.Arrange(viewportRect); this.VerticalScrollBar.Arrange(vertScrollRect); this.HorizontalScrollBar.Arrange(horizScrollRect); this.BlankSpot.Arrange(blankSpotRectRect); ResetScrollPos(); return(finalSize); }