This is a migrated thread and some comments may be shown as answers.

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

1 Answer 42 Views
ScrollBar
This is a migrated thread and some comments may be shown as answers.
Jason
Top achievements
Rank 1
Jason asked on 04 Dec 2015, 08:57 AM

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!

1 Answer, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 07 Dec 2015, 02:11 PM
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
Tags
ScrollBar
Asked by
Jason
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Share this question
or