private void ResetScrollState(RadScrollLayoutPanel.ScrollFlags flags) { bool flag1 = (flags & RadScrollLayoutPanel.ScrollFlags.Horizontal) == RadScrollLayoutPanel.ScrollFlags.Horizontal; bool flag2 = (flags & RadScrollLayoutPanel.ScrollFlags.Vertical) == RadScrollLayoutPanel.ScrollFlags.Vertical; switch (this.horizontalScrollState) { case ScrollState.AutoHide: if (flag1) { this.horizontalScrollBar.Enabled = true; } this.horizontalScrollBar.Visibility = flag1 ? ElementVisibility.Visible : ElementVisibility.Collapsed; break; case ScrollState.AlwaysShow: this.horizontalScrollBar.Enabled = flag1; this.horizontalScrollBar.Visibility = ElementVisibility.Visible; break; case ScrollState.AlwaysHide: this.horizontalScrollBar.Enabled = flag1; this.horizontalScrollBar.Visibility = ElementVisibility.Collapsed; break; } switch (this.verticalScrollState) { case ScrollState.AutoHide: if (flag2) { this.verticalScrollBar.Enabled = true; } this.verticalScrollBar.Visibility = flag2 ? ElementVisibility.Visible : ElementVisibility.Collapsed; break; case ScrollState.AlwaysShow: this.verticalScrollBar.Enabled = flag2; this.verticalScrollBar.Visibility = ElementVisibility.Visible; break; case ScrollState.AlwaysHide: this.verticalScrollBar.Enabled = flag2; this.verticalScrollBar.Visibility = ElementVisibility.Collapsed; break; } if (this.horizontalScrollBar.Visibility == ElementVisibility.Collapsed || this.verticalScrollBar.Visibility == ElementVisibility.Collapsed) { this.blankSpot.Visibility = ElementVisibility.Collapsed; } else { this.blankSpot.Visibility = ElementVisibility.Visible; } }
protected Size GetScrollBarsSize(RadScrollLayoutPanel.ScrollFlags flags) { int height = 0; if (this.horizontalScrollState == ScrollState.AlwaysShow || this.horizontalScrollState == ScrollState.AutoHide && (flags & RadScrollLayoutPanel.ScrollFlags.Horizontal) == RadScrollLayoutPanel.ScrollFlags.Horizontal) { height = this.ScrollThickness; } int width = 0; if (this.verticalScrollState == ScrollState.AlwaysShow || this.verticalScrollState == ScrollState.AutoHide && (flags & RadScrollLayoutPanel.ScrollFlags.Vertical) == RadScrollLayoutPanel.ScrollFlags.Vertical) { width = this.ScrollThickness; } return(new Size(width, height)); }
protected virtual void ArrangeViewPort( RectangleF viewportRect, SizeF finalSize, RadScrollLayoutPanel.ScrollFlags flags) { bool flag1 = (flags & RadScrollLayoutPanel.ScrollFlags.Horizontal) == RadScrollLayoutPanel.ScrollFlags.Horizontal; bool flag2 = (flags & RadScrollLayoutPanel.ScrollFlags.Vertical) == RadScrollLayoutPanel.ScrollFlags.Vertical; if (flag1) { viewportRect.Width = this.viewport.DesiredSize.Width; } if (flag2) { viewportRect.Height = this.viewport.DesiredSize.Height; } this.viewport.Arrange(viewportRect); }
protected override SizeF ArrangeOverride(SizeF finalSize) { (this.viewport as IRadScrollViewport)?.InvalidateViewport(); if (this.viewport == null) { base.ArrangeOverride(finalSize); this.horizontalScrollBar.Visibility = ElementVisibility.Collapsed; this.verticalScrollBar.Visibility = ElementVisibility.Collapsed; return(finalSize); } this.clientSize = Size.Round(finalSize); Size size1 = Size.Round(this.viewport.DesiredSize); this.extentSize = this.UsePhysicalScrolling ? size1 : ((IRadScrollViewport)this.viewport).GetExtentSize(); RadScrollLayoutPanel.ScrollFlags scrollingNeeds = this.GetScrollingNeeds(this.extentSize, this.clientSize); Size scrollBarsSize = this.GetScrollBarsSize(scrollingNeeds); scrollBarsSize.Width = Math.Max(scrollBarsSize.Width, (int)this.VerticalScrollBar.DesiredSize.Width); scrollBarsSize.Height = Math.Max(scrollBarsSize.Height, (int)this.HorizontalScrollBar.DesiredSize.Height); this.viewportSize = Size.Subtract(this.clientSize, scrollBarsSize); this.ResetScrollState(scrollingNeeds); Size size2 = Size.Empty; if (this.BlankSpot.Visibility == ElementVisibility.Visible) { size2 = scrollBarsSize; } float x1 = this.RightToLeft ? (float)scrollBarsSize.Width : 0.0f; float x2 = this.RightToLeft ? (float)scrollBarsSize.Width : 0.0f; float x3 = this.RightToLeft ? 0.0f : finalSize.Width - (float)scrollBarsSize.Width; float x4 = this.RightToLeft ? 0.0f : finalSize.Width - (float)size2.Width; RectangleF viewportRect = new RectangleF(x1, 0.0f, (float)this.viewportSize.Width, (float)this.viewportSize.Height); RectangleF finalRect1 = new RectangleF(x3, 0.0f, (float)scrollBarsSize.Width, Math.Max(0.0f, finalSize.Height - (float)scrollBarsSize.Height)); RectangleF finalRect2 = new RectangleF(x2, finalSize.Height - (float)scrollBarsSize.Height, Math.Max(0.0f, finalSize.Width - (float)scrollBarsSize.Width), (float)scrollBarsSize.Height); RectangleF finalRect3 = new RectangleF(x4, finalSize.Height - (float)size2.Height, (float)size2.Width, (float)size2.Height); this.ArrangeViewPort(viewportRect, finalSize, scrollingNeeds); this.VerticalScrollBar.Arrange(finalRect1); this.HorizontalScrollBar.Arrange(finalRect2); this.BlankSpot.Arrange(finalRect3); this.ResetScrollPos(); return(finalSize); }
protected RadScrollLayoutPanel.ScrollFlags GetScrollingNeeds( Size extentSize, Size clientSize) { bool bitState1 = this.GetBitState(549755813888L); bool bitState2 = this.GetBitState(1099511627776L); this.BitState[549755813888L] = false; this.BitState[1099511627776L] = false; if (extentSize.Width > clientSize.Width) { this.BitState[549755813888L] = true; if (extentSize.Height > clientSize.Height - this.ScrollThickness) { this.BitState[1099511627776L] = true; } } else if (extentSize.Width > clientSize.Width - this.ScrollThickness) { if (extentSize.Height > clientSize.Height) { this.BitState[549755813888L] = true; this.BitState[1099511627776L] = true; } else if (extentSize.Height > clientSize.Height - this.ScrollThickness) { if (this.verticalScrollState != ScrollState.AlwaysHide && this.horizontalScrollState != ScrollState.AlwaysHide && (this.horizontalScrollState != ScrollState.AutoHide || this.verticalScrollState != ScrollState.AutoHide) && (this.verticalScrollBar.Visibility != ElementVisibility.Collapsed && this.verticalScrollState == ScrollState.AlwaysShow || this.horizontalScrollBar.Visibility != ElementVisibility.Collapsed && this.horizontalScrollState == ScrollState.AlwaysShow)) { this.BitState[549755813888L] = true; this.BitState[1099511627776L] = true; } } else if (this.verticalScrollState == ScrollState.AlwaysShow) { this.BitState[549755813888L] = true; } } else if (extentSize.Height > clientSize.Height) { this.BitState[1099511627776L] = true; } else if (extentSize.Height > clientSize.Height - this.ScrollThickness && this.horizontalScrollState == ScrollState.AlwaysShow) { this.BitState[1099511627776L] = true; } bool flag1 = bitState1 != this.GetBitState(549755813888L); bool flag2 = bitState2 != this.GetBitState(1099511627776L); if (flag1 || flag2) { this.OnScrollNeedsChanged(new ScrollNeedsEventArgs(bitState1, this.GetBitState(549755813888L), bitState2, this.GetBitState(1099511627776L))); } RadScrollLayoutPanel.ScrollFlags scrollFlags = (RadScrollLayoutPanel.ScrollFlags) 0; if (this.GetBitState(549755813888L)) { scrollFlags |= RadScrollLayoutPanel.ScrollFlags.Horizontal; } if (this.GetBitState(1099511627776L)) { scrollFlags |= RadScrollLayoutPanel.ScrollFlags.Vertical; } return(scrollFlags); }