Exemple #1
0
        public virtual bool EnsureRowVisible(GridViewRowInfo rowInfo)
        {
            if (rowInfo.ViewInfo != this.ViewInfo || rowInfo.ViewInfo == this.MasterViewInfo && rowInfo.PinPosition != PinnedRowPosition.None || (!this.TableElement.ElementTree.Control.Visible && !(this.TableElement.ElementTree.Control is MultiColumnComboGridView) || (this.TableElement.ElementTree.Control.Size == Size.Empty || (SizeF)this.TableElement.Size == SizeF.Empty)))
            {
                return(false);
            }
            if (this.TableElement.MasterTemplate != null && this.TableElement.MasterTemplate.EnablePaging)
            {
                int pageIndex = this.TableElement.MasterTemplate.PageIndex;
                if (this.TableElement.MasterTemplate.EnableGrouping && this.TableElement.MasterTemplate.GroupDescriptors.Count > 0)
                {
                    int         num        = -2;
                    IEnumerator enumerator = (IEnumerator) new PagedGroupedTraverser(((RadDataView <GridViewRowInfo>) this.TableElement.MasterTemplate.DataView).GroupBuilder.Groups.GroupList);
                    while (enumerator.MoveNext())
                    {
                        GridViewGroupRowInfo current = enumerator.Current as GridViewGroupRowInfo;
                        if (current != null && current.GroupLevel == 0)
                        {
                            ++num;
                        }
                        if (enumerator.Current == rowInfo)
                        {
                            break;
                        }
                    }
                    if (num >= 0)
                    {
                        pageIndex = num / this.TableElement.MasterTemplate.PageSize;
                    }
                }
                else
                {
                    pageIndex = this.TableElement.ViewTemplate.DataView.GetItemPage(rowInfo);
                }
                if (pageIndex != this.TableElement.MasterTemplate.PageIndex && !(rowInfo is GridViewNewRowInfo))
                {
                    this.TableElement.MasterTemplate.MoveToPage(pageIndex);
                    this.TableElement.ViewElement.UpdateRows(true);
                    if (this.TableElement.GridViewElement != null)
                    {
                        this.GridViewElement.PagingPanelElement.UpdateView();
                    }
                }
            }
            this.UpdateLayout();
            GridViewDetailsRowInfo viewDetailsRowInfo = rowInfo as GridViewDetailsRowInfo;

            if (viewDetailsRowInfo == null)
            {
                return(this.EnsureRowVisibleCore(rowInfo));
            }
            RadScrollBarElement vScrollBar = this.UseScrollbarsInHierarchy ? this.VScrollBar : this.MasterVScrollBar;

            if (this.GetRowElement((GridViewRowInfo)viewDetailsRowInfo) is GridDetailViewRowElement || !this.EnsureRowVisibleByTraverser(vScrollBar, (GridViewRowInfo)viewDetailsRowInfo, (float)vScrollBar.SmallChange))
            {
                return(false);
            }
            this.UpdateLayout();
            return(true);
        }
Exemple #2
0
        protected virtual void EnsureRowVisibilityAtBottom(
            GridViewRowInfo rowInfo,
            bool isLastRow,
            RectangleF rowRect,
            RectangleF innerClientRect,
            ref RadScrollBarElement vericalScrollBar,
            ref int scrollValue)
        {
            RadScrollBarElement hscrollBar        = this.TableElement.HScrollBar;
            Rectangle           boundingRectangle = hscrollBar.ControlBoundingRectangle;
            Size size1 = this.TableElement.Size;
            Size size2 = this.ViewElement.TopPinnedRows.Size;
            int  initialDeltaAtBottom = this.GetInitialDeltaAtBottom(size1);
            int  num = (int)((double)rowRect.Bottom - (double)innerClientRect.Bottom);

            if (size1.Height == 0 || size1.Height + this.TableElement.RowSpacing <= size2.Height || (double)size1.Height - (double)rowRect.Height + (double)num == (double)size2.Height)
            {
                vericalScrollBar = this.UseScrollbarsInHierarchy ? this.ParentVScrollBar : this.MasterVScrollBar;
                scrollValue      = vericalScrollBar.Value;
                if (this.IsScrollBarVisible(hscrollBar))
                {
                    initialDeltaAtBottom += boundingRectangle.Size.Height;
                }
            }
            else if (this.IsScrollBarVisible(hscrollBar))
            {
                initialDeltaAtBottom += (int)((double)innerClientRect.Bottom - (double)boundingRectangle.Top);
            }
            else if (this.IsScrollBarVisible(this.ParentHScrollBar))
            {
                initialDeltaAtBottom += (int)((double)innerClientRect.Bottom - (double)this.ParentHScrollBar.ControlBoundingRectangle.Top);
            }
            this.EnsureScrollingDelta(rowInfo, isLastRow, ref initialDeltaAtBottom);
            scrollValue += num + initialDeltaAtBottom;
        }
Exemple #3
0
 protected override void CreateChildElements()
 {
     this.containerVersionNumber = -1;
     this.synchronizationPropertiesVersionNumber = -1;
     base.CreateChildElements();
     this.DrawText        = false;
     this.DrawImage       = false;
     this.ClipDrawing     = true;
     this.Padding         = new Padding(10);
     this.layoutContainer = this.CreateLayoutConatiner();
     this.Children.Add((RadElement)this.layoutContainer);
     this.horizontalScrollBar                  = this.CreateScrollBarElement();
     this.horizontalScrollBar.ScrollType       = ScrollType.Horizontal;
     this.horizontalScrollBar.Minimum          = 0;
     this.horizontalScrollBar.ZIndex           = 1000;
     this.horizontalScrollBar.ThemeRole        = "RadScrollBarElement";
     this.horizontalScrollBar.MinSize          = new Size(0, RadScrollBarElement.HorizontalScrollBarHeight);
     this.horizontalScrollBar.ScrollTimerDelay = 1;
     this.horizontalScrollBar.Visibility       = ElementVisibility.Collapsed;
     this.horizontalScrollBar.ValueChanged    += new EventHandler(this.HorizontalScrollBar_ValueChanged);
     this.Children.Add((RadElement)this.horizontalScrollBar);
     this.verticalScrollBar                  = this.CreateScrollBarElement();
     this.verticalScrollBar.ScrollType       = ScrollType.Vertical;
     this.verticalScrollBar.Minimum          = 0;
     this.verticalScrollBar.ZIndex           = 1000;
     this.verticalScrollBar.ThemeRole        = "RadScrollBarElement";
     this.verticalScrollBar.MinSize          = new Size(RadScrollBarElement.VerticalScrollBarWidth, 0);
     this.verticalScrollBar.ScrollTimerDelay = 1;
     this.verticalScrollBar.Visibility       = ElementVisibility.Collapsed;
     this.verticalScrollBar.ValueChanged    += new EventHandler(this.VerticalScrollBar_ValueChanged);
     this.Children.Add((RadElement)this.verticalScrollBar);
 }
Exemple #4
0
        protected virtual bool TryEnsureRowVisibilityByTraverser(
            GridViewRowInfo rowInfo,
            bool isLastRow,
            RadScrollBarElement verticalScrollBar,
            ScrollableRowsContainerElement scrollableRows,
            out GridRowElement row,
            out bool isTraverserd)
        {
            int num = verticalScrollBar.Maximum - verticalScrollBar.LargeChange + 1;

            if (isLastRow && num != verticalScrollBar.Value)
            {
                this.ChangeScrollbarValue(verticalScrollBar, num);
                this.UpdateLayout();
            }
            row          = this.GetRowElement(rowInfo);
            isTraverserd = false;
            if (row != null)
            {
                return(false);
            }
            int height = (int)this.RowScroller.ElementProvider.GetElementSize(rowInfo).Height;

            this.EnsureScrollingDelta(rowInfo, isLastRow, ref height);
            if (this.UseScrollbarsInHierarchy && scrollableRows.Children.Count > 0)
            {
                GridDetailViewRowElement child = scrollableRows.Children[scrollableRows.Children.Count - 1] as GridDetailViewRowElement;
                height += child != null ? child.RowInfo.Height - child.Size.Height : 0;
            }
            isTraverserd = this.EnsureRowVisibleByTraverser(verticalScrollBar, rowInfo, (float)height);
            return(true);
        }
Exemple #5
0
        private bool EnsureRowVisibleByTraverserDown(
            RadScrollBarElement vScrollBar,
            GridViewRowInfo rowInfo,
            ScrollableRowsContainerElement rows,
            float delta)
        {
            GridRowElement child      = (GridRowElement)rows.Children[rows.Children.Count - 1];
            GridTraverser  enumerator = (GridTraverser)((IEnumerable)this.RowScroller).GetEnumerator();

            while (enumerator.Current is GridViewDetailsRowInfo)
            {
                enumerator.MoveNext();
            }
            enumerator.MovePrevious();
            if (enumerator.Current == rowInfo)
            {
                return(this.ChangeScrollbarValue(vScrollBar, vScrollBar.Value - (int)delta));
            }
            do
            {
                ;
            }while (enumerator.MoveNext() && enumerator.Current != child.RowInfo);
            enumerator.MoveNext();
            if (enumerator.Current == rowInfo)
            {
                return(this.ChangeScrollbarValue(vScrollBar, vScrollBar.Value + (int)delta));
            }
            return(false);
        }
        protected override void CreateChildElements()
        {
            this.horizontalScrollBar            = new RadScrollBarElement();
            this.horizontalScrollBar.ScrollType = ScrollType.Horizontal;
            this.horizontalScrollBar.Visibility = ElementVisibility.Collapsed;
            this.horizontalScrollBar.Minimum    = 0;
            this.horizontalScrollBar.ZIndex     = 1000;
            this.horizontalScrollBar.Class      = "ScrollPanelHorizontalScrollBar";
            this.horizontalScrollBar.ThemeRole  = "RadScrollBarElement";
            this.Children.Add(this.horizontalScrollBar);

            this.verticalScrollBar            = new RadScrollBarElement();
            this.verticalScrollBar.ScrollType = ScrollType.Vertical;
            this.verticalScrollBar.Visibility = ElementVisibility.Collapsed;
            this.verticalScrollBar.Minimum    = 0;
            this.verticalScrollBar.ZIndex     = 1000;
            this.verticalScrollBar.Class      = "ScrollPanelVerticalScrollBar";
            this.verticalScrollBar.ThemeRole  = "RadScrollBarElement";
            this.Children.Add(this.verticalScrollBar);

            this.blankSpot               = new FillPrimitive();
            this.blankSpot.Class         = "ScrollPanelBlankSpotFill";
            this.blankSpot.Visibility    = ElementVisibility.Collapsed;
            this.blankSpot.ZIndex        = 1000;
            this.blankSpot.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.None;
            this.Children.Add(this.blankSpot);

            this.horizontalScrollBar.Scroll += OnHScroll;
            this.verticalScrollBar.Scroll   += OnVScroll;
            this.horizontalScrollBar.ScrollParameterChanged += new EventHandler(OnScrollBarParameterChanged);
            this.verticalScrollBar.ScrollParameterChanged   += new EventHandler(OnScrollBarParameterChanged);
        }
Exemple #7
0
        protected virtual bool EnsureRowVisibleCore(GridViewRowInfo rowInfo)
        {
            bool           isTraverserd = false;
            bool           isLastRow    = false;
            bool           isFirstRow   = false;
            GridRowElement row          = this.GetRowElement(rowInfo);

            this.DetermineScrollableRowPosition(rowInfo, out isFirstRow, out isLastRow);
            ScrollableRowsContainerElement scrollableRows   = this.ViewElement.ScrollableRows;
            RadScrollBarElement            vericalScrollBar = this.UseScrollbarsInHierarchy ? this.VScrollBar : this.MasterVScrollBar;

            if (row == null && this.TryEnsureRowVisibilityByTraverser(rowInfo, isLastRow, vericalScrollBar, scrollableRows, out row, out isTraverserd))
            {
                return(isTraverserd);
            }
            RectangleF boundingRectangle1   = (RectangleF)this.MasterTableElement.ViewElement.ScrollableRows.ControlBoundingRectangle;
            RectangleF innerClientRectangle = this.GetInnerClientRectangle(rowInfo);
            Rectangle  boundingRectangle2   = row.ControlBoundingRectangle;
            int        scrollValue          = vericalScrollBar.Value;

            if (this.GridViewElement.SplitMode != RadGridViewSplitMode.None && this.MasterTableElement != row.TableElement)
            {
                return(false);
            }
            if ((double)boundingRectangle2.Bottom > (double)boundingRectangle1.Bottom || (double)boundingRectangle2.Bottom > (double)innerClientRectangle.Bottom)
            {
                this.EnsureRowVisibilityAtBottom(rowInfo, isLastRow, (RectangleF)boundingRectangle2, innerClientRectangle, ref vericalScrollBar, ref scrollValue);
            }
            else if ((double)boundingRectangle2.Y < (double)boundingRectangle1.Y || this.ParentHScrollBar.Visibility == ElementVisibility.Visible && this.ParentHScrollBar.ControlBoundingRectangle.IntersectsWith(boundingRectangle2) || this.UseScrollbarsInHierarchy && (double)boundingRectangle2.Y < (double)innerClientRectangle.Y)
            {
                this.EnsureRowVisibilityAtTop((RectangleF)boundingRectangle2, boundingRectangle1, innerClientRectangle, ref vericalScrollBar, ref scrollValue);
            }
            return(this.ChangeScrollbarValue(vericalScrollBar, scrollValue));
        }
Exemple #8
0
        private void ScrollColumns(GridTableElement tableElement, Point location)
        {
            GridTableHeaderRowElement rowElement = tableElement.GetRowElement((GridViewRowInfo)tableElement.ViewInfo.TableHeaderRow) as GridTableHeaderRowElement;

            if (rowElement == null)
            {
                return;
            }
            Rectangle boundingRectangle1 = rowElement.ControlBoundingRectangle;
            Rectangle boundingRectangle2 = rowElement.ScrollableColumns.ControlBoundingRectangle;
            int       num = 0;

            if (location.X > boundingRectangle2.Right)
            {
                num = location.X - boundingRectangle2.Right;
            }
            else if (location.X < boundingRectangle2.X)
            {
                num = location.X - boundingRectangle2.X;
            }
            RadScrollBarElement hscrollBar = tableElement.HScrollBar;

            if (tableElement.RightToLeft)
            {
                num *= -1;
            }
            if (num == 0 || hscrollBar.Visibility != ElementVisibility.Visible)
            {
                return;
            }
            hscrollBar.Value = this.ClampValue(hscrollBar.Value + num, hscrollBar.Minimum, hscrollBar.Maximum - hscrollBar.LargeChange + 1);
        }
        protected virtual bool UpdateOnMeasure(SizeF availableSize)
        {
            RectangleF          clientRectangle   = this.GetClientRectangle(availableSize);
            RadScrollBarElement scrollBarElement1 = this.HScrollBar;
            RadScrollBarElement scrollBarElement2 = this.VScrollBar;

            if (this.Orientation == Orientation.Horizontal)
            {
                scrollBarElement1 = this.VScrollBar;
                scrollBarElement2 = this.HScrollBar;
            }
            ElementVisibility visibility = scrollBarElement1.Visibility;

            if (this.FitItemsToSize)
            {
                this.HScrollBar.Visibility = ElementVisibility.Collapsed;
            }
            else
            {
                scrollBarElement1.LargeChange = (int)((double)clientRectangle.Width - (double)scrollBarElement2.DesiredSize.Width - (double)this.ViewElement.Margin.Horizontal);
                scrollBarElement1.SmallChange = scrollBarElement1.LargeChange / 10;
                scrollBarElement1.Visibility  = scrollBarElement1.LargeChange < scrollBarElement1.Maximum ? ElementVisibility.Visible : ElementVisibility.Collapsed;
            }
            SizeF size = clientRectangle.Size;

            if (this.HScrollBar.Visibility == ElementVisibility.Visible)
            {
                size.Height -= this.HScrollBar.DesiredSize.Height;
            }
            this.scroller.ClientSize = size;
            return(visibility != scrollBarElement1.Visibility);
        }
Exemple #10
0
        private void ScrollRows(GridTableElement tableElement, Point location)
        {
            ScrollableRowsContainerElement scrollableRows    = tableElement.ViewElement.ScrollableRows;
            RadScrollBarElement            veritcalScrollbar = this.GetVeritcalScrollbar(tableElement);
            Rectangle boundingRectangle = scrollableRows.ControlBoundingRectangle;

            if (boundingRectangle.Contains(location) || location.X < boundingRectangle.X || location.X > boundingRectangle.Right)
            {
                return;
            }
            int num = 0;

            if (location.Y > boundingRectangle.Bottom)
            {
                num = location.Y - boundingRectangle.Bottom;
            }
            else if (location.Y < boundingRectangle.Y)
            {
                num = location.Y - boundingRectangle.Y;
            }
            if (num == 0 || veritcalScrollbar.Visibility != ElementVisibility.Visible)
            {
                return;
            }
            veritcalScrollbar.Value = this.ClampValue(veritcalScrollbar.Value + num, veritcalScrollbar.Minimum, veritcalScrollbar.Maximum - veritcalScrollbar.LargeChange + 1);
        }
Exemple #11
0
        private void scrollTimer_Tick(object sender, EventArgs e)
        {
            if (this.scrollDelta == 0 || this.tableElement == null)
            {
                return;
            }
            RadScrollBarElement scrollBarElement = Control.ModifierKeys != Keys.Shift ? this.tableElement.VScrollBar : this.tableElement.HScrollBar;
            int num = scrollBarElement.Value + this.scrollDelta;

            if (num < scrollBarElement.Minimum)
            {
                num = scrollBarElement.Minimum;
            }
            else if (num > scrollBarElement.Maximum - scrollBarElement.LargeChange + 1)
            {
                num = scrollBarElement.Maximum - scrollBarElement.LargeChange + 1;
            }
            if (scrollBarElement.LargeChange > 0)
            {
                scrollBarElement.Value = num;
            }
            if (this.scrollReason == BaseGridBehavior.ScrollReason.PageUp)
            {
                this.NavigateToPage(this.GetFirstScrollableRow(this.tableElement, true), Keys.None);
            }
            else if (this.scrollReason == BaseGridBehavior.ScrollReason.PageDown)
            {
                this.NavigateToPage(this.GetLastScrollableRow(this.tableElement), Keys.None);
                this.GridViewElement.TableElement.RowScroller.UpdateScrollRange();
            }
            this.scrollReason = BaseGridBehavior.ScrollReason.MouseWheel;
            this.scrollDelta  = 0;
            this.scrollTimer.Stop();
        }
Exemple #12
0
        protected override void OnMouseWheel(MouseEventArgs e)
        {
            RadScrollLayoutPanel scrollLayoutPanel = this.ColumnChooserElement.ScrollViewer.ScrollLayoutPanel;
            RadScrollBarElement  verticalScrollBar = scrollLayoutPanel.VerticalScrollBar;

            if (verticalScrollBar.Visibility == ElementVisibility.Visible)
            {
                int num1 = Math.Max(1, e.Delta / SystemInformation.MouseWheelScrollDelta);
                int num2 = Math.Sign(e.Delta) * num1 * SystemInformation.MouseWheelScrollLines;
                int ypos = verticalScrollBar.Value - num2 * verticalScrollBar.SmallChange;
                if (ypos > verticalScrollBar.Maximum - verticalScrollBar.LargeChange + 1)
                {
                    ypos = verticalScrollBar.Maximum - verticalScrollBar.LargeChange + 1;
                }
                if (ypos < verticalScrollBar.Minimum)
                {
                    ypos = 0;
                }
                else if (ypos > verticalScrollBar.Maximum)
                {
                    ypos = verticalScrollBar.Maximum;
                }
                if (ypos != verticalScrollBar.Value)
                {
                    scrollLayoutPanel.ScrollTo(0, ypos);
                    HandledMouseEventArgs handledMouseEventArgs = e as HandledMouseEventArgs;
                    if (handledMouseEventArgs != null)
                    {
                        handledMouseEventArgs.Handled = true;
                    }
                }
            }
            base.OnMouseWheel(e);
        }
Exemple #13
0
        protected virtual bool UpdateOnMeasure(SizeF availableSize)
        {
            RectangleF clientRect = GetClientRectangle(availableSize);

            RadScrollBarElement hscrollbar = this.HScrollBar;
            RadScrollBarElement vscrollbar = this.VScrollBar;

            if (this.Orientation == Orientation.Horizontal)
            {
                hscrollbar = this.VScrollBar;
                vscrollbar = this.HScrollBar;
            }
            ElementVisibility visibility = hscrollbar.Visibility;

            if (FitItemsToSize)
            {
                HScrollBar.Visibility = ElementVisibility.Collapsed;
            }
            else
            {
                hscrollbar.LargeChange = (int)(clientRect.Width - vscrollbar.DesiredSize.Width - this.ViewElement.Margin.Horizontal);
                hscrollbar.SmallChange = hscrollbar.LargeChange / 10;
                hscrollbar.Visibility  = hscrollbar.LargeChange < hscrollbar.Maximum ? ElementVisibility.Visible : ElementVisibility.Collapsed;
            }

            SizeF clientSize = clientRect.Size;

            if (HScrollBar.Visibility == ElementVisibility.Visible)
            {
                clientSize.Height -= HScrollBar.DesiredSize.Height;
            }
            this.scroller.ClientSize = clientSize;

            return(visibility != hscrollbar.Visibility);
        }
Exemple #14
0
        private void radMenuItem5_Click(object sender, EventArgs e)
        {
            RadScrollBarElement scrollbar = new RadScrollBarElement();

            surface1.Element.Children.Add(new SurfaceObject(10, 10, scrollbar));
            radButtonRemove.Enabled        = true;
            surface1.Element.CurrentObject = (SurfaceObject)surface1.Element.Children[surface1.Element.Children.Count - 1];
        }
Exemple #15
0
 public ScrollService(RadElement owner, RadScrollBarElement scrollBar)
 {
     this.owner          = owner;
     this.scrollBar      = scrollBar;
     this.timer          = new Timer();
     this.timer.Interval = 5;
     this.timer.Tick    += new EventHandler(timer_Tick);
 }
Exemple #16
0
 private bool IsScrollBarVisible(RadScrollBarElement scrollBar)
 {
     if (scrollBar.Visibility != ElementVisibility.Visible)
     {
         return(false);
     }
     return(this.MasterTableElement.ViewElement.ScrollableRows.ControlBoundingRectangle.IntersectsWith(scrollBar.ControlBoundingRectangle));
 }
 private int GetScrollBarValue(RadScrollBarElement scrollBar)
 {
     if (scrollBar.Visibility == ElementVisibility.Visible)
     {
         return(scrollBar.Value);
     }
     return(scrollBar.Minimum);
 }
 protected virtual void OnScrollParametersChanged(RadScrollBarElement scrollBar)
 {
     if (scrollBar == null || this.ScrollParametersChanged == null)
     {
         return;
     }
     this.ScrollParametersChanged((object)this, new RadPanelScrollParametersEventArgs(scrollBar.ScrollType == ScrollType.Horizontal, scrollBar.GetParameters()));
 }
 protected virtual void OnScrollParametersChanged(RadScrollBarElement scrollBar)
 {
     if (scrollBar != null && ScrollParametersChanged != null)
     {
         ScrollParametersChanged(this, new RadPanelScrollParametersEventArgs(
                                     scrollBar.ScrollType == ScrollType.Horizontal, scrollBar.GetParameters()));
     }
 }
Exemple #20
0
        private void SetPosition(MouseEventArgs e, bool dragging)
        {
            RadScrollBarElement scrollBar = this.Parent as RadScrollBarElement;

            if (scrollBar != null)
            {
                scrollBar.SetThumbPosition(GetNewLocation(e), dragging);
            }
        }
Exemple #21
0
 protected override void CreateChildItems(RadElement parent)
 {
     base.CreateChildItems((RadElement)this.scrollBar);
     this.scrollBar                         = this.CreateScrollBarElement();
     this.scrollBar.ScrollType              = this.ScrollType;
     this.scrollBar.Scroll                 += new ScrollEventHandler(this.scrollBar_Scroll);
     this.scrollBar.ValueChanged           += new EventHandler(this.scrollBar_ValueChanged);
     this.scrollBar.ScrollParameterChanged += new EventHandler(this.scrollBar_ScrollParameterChanged);
     this.RootElement.Children.Add((RadElement)this.scrollBar);
 }
        public virtual bool ScrollToCaret()
        {
            TextBoxControlCaret caret      = this.TextBoxElement.Caret;
            RadScrollBarElement hscrollBar = this.textBoxElement.HScrollBar;
            RadScrollBarElement vscrollBar = this.textBoxElement.VScrollBar;

            if (caret == null || this.CaretPosition == (TextPosition)null)
            {
                vscrollBar.Value = vscrollBar.Minimum;
                hscrollBar.Value = hscrollBar.Minimum;
                return(false);
            }
            RectangleF boundingRectangle = (RectangleF)caret.ControlBoundingRectangle;
            RectangleF viewportBounds    = (RectangleF)this.TextBoxElement.ViewElement.ViewportBounds;
            float      num1         = 0.0f;
            float      num2         = 0.0f;
            LineInfo   line         = this.CaretPosition.Line;
            ITextBlock textBlock    = this.CaretPosition.TextBlock;
            int        charPosition = this.CaretPosition.CharPosition;

            if (textBlock == line.StartBlock && charPosition == 0)
            {
                num1 = (float)(hscrollBar.Minimum - hscrollBar.Value);
            }
            else if ((double)boundingRectangle.X > (double)viewportBounds.Right || (double)boundingRectangle.X < (double)viewportBounds.Left)
            {
                num1 = boundingRectangle.X - viewportBounds.X - viewportBounds.Width / 2f;
            }
            this.SetScrollBarValue(hscrollBar, hscrollBar.Value + (int)num1);
            if (this.textBoxElement.Multiline)
            {
                if (line == this.textBoxElement.ViewElement.Lines.FirstLine)
                {
                    num2 = (float)(vscrollBar.Minimum - vscrollBar.Value);
                }
                else if (line == this.textBoxElement.ViewElement.Lines.LastLine)
                {
                    int num3 = this.textBoxElement.ViewElement.VScroller.MaxValue - 1;
                    if (num3 != 0)
                    {
                        num2 = (float)(num3 - vscrollBar.Value + 1);
                    }
                }
                else if ((double)boundingRectangle.Top < (double)viewportBounds.Top)
                {
                    num2 = boundingRectangle.Top - viewportBounds.Top;
                }
                else if ((double)boundingRectangle.Bottom > (double)viewportBounds.Bottom)
                {
                    num2 = boundingRectangle.Bottom - viewportBounds.Bottom;
                }
                this.SetScrollBarValue(vscrollBar, vscrollBar.Value + (int)num2);
            }
            return(true);
        }
 protected void SetScrollValue(RadScrollBarElement scrollbar, int newValue)
 {
     if (newValue > scrollbar.Maximum - scrollbar.LargeChange + 1)
     {
         newValue = scrollbar.Maximum - scrollbar.LargeChange + 1;
     }
     if (newValue < scrollbar.Minimum)
     {
         newValue = scrollbar.Minimum;
     }
     scrollbar.Value = newValue;
 }
Exemple #24
0
 protected override void CreateChildElements()
 {
     base.CreateChildElements();
     this.itemsLayout = new StackLayoutPanel();
     this.Children.Add((RadElement)this.itemsLayout);
     this.scrollBar               = new RadScrollBarElement();
     this.scrollBar.ScrollType    = ScrollType.Horizontal;
     this.scrollBar.ValueChanged += new EventHandler(this.scrollBar_ValueChanged);
     this.Children.Add((RadElement)this.scrollBar);
     this.scrollService = new ScrollService((RadElement)this, this.scrollBar);
     this.scrollService.EnableInertia = true;
 }
Exemple #25
0
 public TextBoxScroller(RadScrollBarElement scrollBar)
 {
     this.scrollBar               = scrollBar;
     this.scrollBar.ClampValue    = true;
     this.scrollBar.ValueChanged += new EventHandler(this.OnScrollBarValueChanged);
     this.scrollBar.Scroll       += new ScrollEventHandler(this.OnScrollBarScroll);
     this.scrollBar.Visibility    = ElementVisibility.Collapsed;
     this.thumbTimer              = new Timer();
     this.thumbTimer.Interval     = 10;
     this.thumbTimer.Enabled      = false;
     this.thumbTimer.Tick        += new EventHandler(this.OnThumbTimerTick);
     this.scrollState             = ScrollState.AutoHide;
 }
 protected override void CreateChildElements()
 {
     base.CreateChildElements();
     this.Header.RadPropertyChanged += this.OnNCElement_PropertyChanged;
     this.Footer.RadPropertyChanged += this.OnNCElement_PropertyChanged;
     this.scrollbar             = new RadScrollBarElement();
     this.scrollbar.Visibility  = ElementVisibility.Collapsed;
     this.scrollbar.ScrollType  = ScrollType.Vertical;
     this.scrollbar.Scroll     += this.OnScrollbar_Scroll;
     this.scrollbar.SmallChange = 5;
     this.scrollbar.ZIndex      = 3;
     this.Children.Add(this.scrollbar);
 }
Exemple #27
0
 protected bool ChangeScrollbarValue(RadScrollBarElement scrollbar, int value)
 {
     if (value > scrollbar.Maximum - scrollbar.LargeChange + 1)
     {
         value = scrollbar.Maximum - scrollbar.LargeChange + 1;
     }
     if (value < scrollbar.Minimum || value > scrollbar.Maximum)
     {
         return(false);
     }
     scrollbar.Value = value;
     return(true);
 }
Exemple #28
0
        protected virtual bool EnsureRowVisibleByTraverser(
            RadScrollBarElement vScrollBar,
            GridViewRowInfo rowInfo,
            float delta)
        {
            ScrollableRowsContainerElement scrollableRows = this.ViewElement.ScrollableRows;
            RadElementCollection           children       = scrollableRows.Children;
            int num1 = vScrollBar.Maximum - vScrollBar.LargeChange + 1;

            while (vScrollBar.Maximum != 0 && children.Count == 0)
            {
                this.ChangeScrollbarValue(vScrollBar, vScrollBar.Value + 1);
                this.UpdateLayout();
                if (scrollableRows.Children.Count > 0 || vScrollBar.Value == num1 || vScrollBar.Value == vScrollBar.Maximum)
                {
                    break;
                }
            }
            if (children.Count == 0)
            {
                return(false);
            }
            if (this.EnsureRowVisibleByTraverserDown(vScrollBar, rowInfo, scrollableRows, delta))
            {
                return(true);
            }
            GridRowElement child = (GridRowElement)scrollableRows.Children[0];

            if (((GridTraverser)((IEnumerable)this.RowScroller).GetEnumerator()).Current == rowInfo)
            {
                int num2 = vScrollBar.Value - (int)delta;
                if (num2 < vScrollBar.Minimum)
                {
                    num2 = vScrollBar.Minimum;
                }
                else if (num2 > vScrollBar.Maximum)
                {
                    num2 = vScrollBar.Maximum;
                }
                return(this.ChangeScrollbarValue(vScrollBar, num2));
            }
            GridViewGroupRowInfo parent = rowInfo.Parent as GridViewGroupRowInfo;

            if (parent != null && !parent.IsExpanded)
            {
                return(false);
            }
            return(this.RowScroller.ScrollToItem(rowInfo, false));
        }
        private void SetScrollBarValue(RadScrollBarElement scrollBar, int value)
        {
            int minimum = scrollBar.Minimum;
            int num     = scrollBar.Maximum - scrollBar.LargeChange + 1;

            if (value > num)
            {
                value = num;
            }
            if (value < minimum)
            {
                value = minimum;
            }
            scrollBar.Value = value;
        }
Exemple #30
0
            /// <summary>
            /// Scroll to Top of RadChat Conversation
            /// </summary>
            /// <param name="radchat">RadChat Control</param>
            public void ScrollToTop(RadChat radchat)
            {
                RadScrollBarElement scrollbar = radchat.ChatElement.MessagesViewElement.Scroller.Scrollbar;

                scrollbar.Value = 0;

                while (scrollbar.Value < scrollbar.Maximum - scrollbar.LargeChange + 1)
                {
                    scrollbar.PerformSmallIncrement(-1);
                    radchat.ChatElement.MessagesViewElement.Scroller.UpdateScrollRange();
                    Application.DoEvents();
                }

                scrollbar.PerformLast();
            }