Example #1
0
        protected virtual void ArrangeVScrollBar(ref RectangleF viewElementRect, RectangleF hscrollBarRect, RectangleF clientRect)
        {
            if (vscrollBar.Visibility != ElementVisibility.Collapsed)
            {
                int scrollbarWidth = (int)vscrollBar.DesiredSize.Width;
                if (scrollbarWidth == 0)
                {
                    scrollbarWidth = SystemInformation.VerticalScrollBarWidth;
                }

                float      x              = clientRect.Right - scrollbarWidth;
                float      height         = clientRect.Height - hscrollBarRect.Height;
                RectangleF vscrollBarRect = new RectangleF(x, clientRect.Y, scrollbarWidth, height);
                if (RightToLeft)
                {
                    vscrollBarRect.X   = clientRect.X;
                    viewElementRect.X += scrollbarWidth;
                }
                vscrollBar.Arrange(vscrollBarRect);
                viewElementRect.Width -= scrollbarWidth;
            }
        }
Example #2
0
        protected virtual RectangleF ArrangeHScrollBar(ref RectangleF viewElementRect, RectangleF clientRect)
        {
            RectangleF hscrollBarRect = RectangleF.Empty;

            if (hscrollBar.Visibility != ElementVisibility.Collapsed)
            {
                int scrollbarHeight = (int)hscrollBar.DesiredSize.Height;
                if (scrollbarHeight == 0)
                {
                    scrollbarHeight = SystemInformation.HorizontalScrollBarHeight;
                }
                float y     = clientRect.Bottom - scrollbarHeight;
                float width = clientRect.Width - vscrollBar.DesiredSize.Width;
                hscrollBarRect = new RectangleF(clientRect.X, y, width, scrollbarHeight);
                if (RightToLeft && vscrollBar.Visibility != ElementVisibility.Collapsed)
                {
                    hscrollBarRect.X += vscrollBar.DesiredSize.Width;
                }
                hscrollBar.Arrange(hscrollBarRect);
                viewElementRect.Height -= hscrollBar.DesiredSize.Height;
            }

            return(hscrollBarRect);
        }