Not consistent width for ScrollablePanel's Scollbar's buttons and thumb

2 posts, 0 answers
  1. Jason
    Jason avatar
    2 posts
    Member since:
    Nov 2015

    Posted 04 Dec 2015 Link to this post

    I cannot make same width for first and second buttons and thumb. There is always right margins in the buttons. The below is my coding:
                this.PanelElement.Fill.BackColor = Color.Transparent;
                this.PanelElement.Fill.GradientStyle = GradientStyles.Solid;
                this.RootElement.BackColor = Color.Transparent;
                this.RootElement.ForeColor = Color.Transparent;
                ((FillPrimitive)this.VerticalScrollbar.ScrollBarElement.Children[1]).GradientStyle = GradientStyles.Solid;
                ((FillPrimitive)this.VerticalScrollbar.ScrollBarElement.Children[1]).BackColor = FXStyle.ColorForKey("ScrollBarBackColor");
                this.VerticalScrollbar.ScrollBarElement.FirstButton.ButtonBorder.FitToSizeMode = RadFitToSizeMode.FitToParentContent;
                this.VerticalScrollbar.ScrollBarElement.FirstButton.ButtonFill.GradientStyle = GradientStyles.Solid;
                this.VerticalScrollbar.ScrollBarElement.FirstButton.ButtonFill.BackColor = FXStyle.ColorForKey("ScrollBarButtonBackColor");
                this.VerticalScrollbar.ScrollBarElement.FirstButton.ArrowPrimitive.ForeColor = FXStyle.ColorForKey("ScrollBarButtonArrowBackColor");
                this.VerticalScrollbar.ScrollBarElement.FirstButton.ButtonBorder.BoxStyle = BorderBoxStyle.FourBorders;
                this.VerticalScrollbar.ScrollBarElement.FirstButton.ButtonBorder.LeftColor = FXStyle.ColorForKey("ScrollBarButtonLeftTopBorderColor");
                this.VerticalScrollbar.ScrollBarElement.FirstButton.ButtonBorder.LeftShadowColor = FXStyle.ColorForKey("ScrollBarButtonLeftTopBorderColor");
                this.VerticalScrollbar.ScrollBarElement.FirstButton.ButtonBorder.LeftWidth = 1;
                this.VerticalScrollbar.ScrollBarElement.FirstButton.ButtonBorder.TopColor = Color.Yellow;
                this.VerticalScrollbar.ScrollBarElement.FirstButton.ButtonBorder.TopShadowColor = Color.Yellow;
                this.VerticalScrollbar.ScrollBarElement.FirstButton.ButtonBorder.TopWidth = 1;
                this.VerticalScrollbar.ScrollBarElement.FirstButton.ButtonBorder.RightColor = FXStyle.ColorForKey("ScrollBarButtonRightBottomBorderColor");
                this.VerticalScrollbar.ScrollBarElement.FirstButton.ButtonBorder.RightShadowColor = FXStyle.ColorForKey("ScrollBarButtonRightBottomBorderColor");
                this.VerticalScrollbar.ScrollBarElement.FirstButton.ButtonBorder.RightWidth = 1;
                this.VerticalScrollbar.ScrollBarElement.FirstButton.ButtonBorder.BottomColor = Color.Red;
                this.VerticalScrollbar.ScrollBarElement.FirstButton.ButtonBorder.BottomShadowColor = Color.Red;
                this.VerticalScrollbar.ScrollBarElement.FirstButton.ButtonBorder.BottomWidth = 1;

                this.VerticalScrollbar.ScrollBarElement.SecondButton.ButtonBorder.FitToSizeMode = RadFitToSizeMode.FitToParentContent;
                this.VerticalScrollbar.ScrollBarElement.SecondButton.ButtonFill.GradientStyle = GradientStyles.Solid;
                this.VerticalScrollbar.ScrollBarElement.SecondButton.ButtonFill.BackColor = FXStyle.ColorForKey("ScrollBarButtonBackColor");
                this.VerticalScrollbar.ScrollBarElement.SecondButton.ArrowPrimitive.ForeColor = FXStyle.ColorForKey("ScrollBarButtonArrowBackColor");
                this.VerticalScrollbar.ScrollBarElement.SecondButton.ButtonBorder.BoxStyle = BorderBoxStyle.FourBorders;
                this.VerticalScrollbar.ScrollBarElement.SecondButton.ButtonBorder.LeftColor = FXStyle.ColorForKey("ScrollBarButtonLeftTopBorderColor");
                this.VerticalScrollbar.ScrollBarElement.SecondButton.ButtonBorder.LeftShadowColor = FXStyle.ColorForKey("ScrollBarButtonLeftTopBorderColor");
                this.VerticalScrollbar.ScrollBarElement.SecondButton.ButtonBorder.LeftWidth = 1;
                this.VerticalScrollbar.ScrollBarElement.SecondButton.ButtonBorder.TopColor = Color.Yellow;
                this.VerticalScrollbar.ScrollBarElement.SecondButton.ButtonBorder.TopShadowColor = Color.Yellow;
                this.VerticalScrollbar.ScrollBarElement.SecondButton.ButtonBorder.TopWidth = 1;
                this.VerticalScrollbar.ScrollBarElement.SecondButton.ButtonBorder.RightColor = FXStyle.ColorForKey("ScrollBarButtonRightBottomBorderColor");
                this.VerticalScrollbar.ScrollBarElement.SecondButton.ButtonBorder.RightShadowColor = FXStyle.ColorForKey("ScrollBarButtonRightBottomBorderColor");
                this.VerticalScrollbar.ScrollBarElement.SecondButton.ButtonBorder.RightWidth = 1;
                this.VerticalScrollbar.ScrollBarElement.SecondButton.ButtonBorder.BottomColor = Color.Red;
                this.VerticalScrollbar.ScrollBarElement.SecondButton.ButtonBorder.BottomShadowColor = Color.Red;
                this.VerticalScrollbar.ScrollBarElement.SecondButton.ButtonBorder.BottomWidth = 1;

                this.VerticalScrollbar.ScrollBarElement.ThumbElement.GripImage = null;
                this.VerticalScrollbar.ScrollBarElement.ThumbElement.ThumbFill.GradientStyle = GradientStyles.Solid;
                this.VerticalScrollbar.ScrollBarElement.ThumbElement.ThumbFill.BackColor = FXStyle.ColorForKey("ScrollBarThumbBackColor");
                this.VerticalScrollbar.ScrollBarElement.ThumbElement.ThumbBorder.PaintUsingParentShape = false;
                this.VerticalScrollbar.ScrollBarElement.ThumbElement.ThumbBorder.BoxStyle = BorderBoxStyle.FourBorders;
                this.VerticalScrollbar.ScrollBarElement.ThumbElement.ThumbBorder.LeftColor = FXStyle.ColorForKey("ScrollBarThumbRightBorderColor");
                this.VerticalScrollbar.ScrollBarElement.ThumbElement.ThumbBorder.LeftShadowColor = FXStyle.ColorForKey("ScrollBarThumbRightBorderColor");
                this.VerticalScrollbar.ScrollBarElement.ThumbElement.ThumbBorder.LeftWidth = 1;
                this.VerticalScrollbar.ScrollBarElement.ThumbElement.ThumbBorder.TopColor = Color.Red;
                this.VerticalScrollbar.ScrollBarElement.ThumbElement.ThumbBorder.TopShadowColor = Color.Red;
                this.VerticalScrollbar.ScrollBarElement.ThumbElement.ThumbBorder.TopWidth = 1;
                this.VerticalScrollbar.ScrollBarElement.ThumbElement.ThumbBorder.RightColor = FXStyle.ColorForKey("ScrollBarThumbLeftTopBottomBorderColor");
                this.VerticalScrollbar.ScrollBarElement.ThumbElement.ThumbBorder.RightShadowColor = FXStyle.ColorForKey("ScrollBarThumbLeftTopBottomBorderColor");
                this.VerticalScrollbar.ScrollBarElement.ThumbElement.ThumbBorder.RightWidth = 1;
                this.VerticalScrollbar.ScrollBarElement.ThumbElement.ThumbBorder.BottomColor = Color.Yellow;
                this.VerticalScrollbar.ScrollBarElement.ThumbElement.ThumbBorder.BottomShadowColor = Color.Yellow;
                this.VerticalScrollbar.ScrollBarElement.ThumbElement.ThumbBorder.BottomWidth = 1;

    Please help to fix it. Thank you!

  2. Hristo Merdjanov
    Admin
    Hristo Merdjanov avatar
    710 posts

    Posted 07 Dec 2015 Link to this post

    Hi Jason,

    Thank you for writing.

    I managed to achieve the desired result by applying additional margin to the first and second buttons of the scrollbar element: 
    this.radScrollablePanel1.VerticalScrollbar.ScrollBarElement.FirstButton.ButtonBorder.Margin = new Padding(0, 0, -2, 0);
    this.radScrollablePanel1.VerticalScrollbar.ScrollBarElement.SecondButton.ButtonBorder.Margin = new Padding(0, 0, -2, 0);

    I am also sending you a screenshot of the result on my end.

    I hope this helps. Should you have further questions please do not hesitate to write back.

    Regards,
    Hristo Merdjanov
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top