Change scroll bar width

Clint79

Member
Joined
Apr 13, 2010
Messages
7
Programming Experience
Beginner
This is hopefully a very simple question. I have not worked with resx or xml before. I am writing a touch screen program and want to change the scroll bar width so big fingers can use them...
I found the following code with the comment "put this in the resource file for your app and it should change all scrollbars to a thicker width."

Code:
<Style x:Key="{x:Type ScrollBar}" TargetType="{x:Type ScrollBar}"> 
                <Setter Property="Stylus.IsFlicksEnabled" Value="True" /> 
                <Setter Property="Background" Value="#D5E0FF" /> 
                <Setter Property="Width" Value="40" /> 
                <Setter Property="MinWidth" Value="40" /> 
        </Style>
My question is (an I hope it is not a stupid one) how do I put this into the existing resource file? I can open the resource file but am not sure where in the file it needs to go.

Thanks in advance for your advice.
 

Clint79

Member
Joined
Apr 13, 2010
Messages
7
Programming Experience
Beginner
No one can help?

Over 1000 views and noone can help me out? :confused:
I thought this was a simple question, can anyone tell me why noone seems to have an answer for me (and the hundreds of people looking at the post)?
Please help!
 

Clint79

Member
Joined
Apr 13, 2010
Messages
7
Programming Experience
Beginner
It was some time ago when I posted this question. I have been asked if I sorted this out so below is the solution I used (I should have posted this earlier but better late than never).

As I was unable to get large scroll bars on the standard panel I created a HScrollBar (which can be resized to be wider) over the top of the edge of the panel so that the panels horizontal scroll bar was no longer visible. I then used the following code to setup the scroll bar, make it visible when required and to perform the scrolling


Code:
Private Sub HScrollBar1_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles HScrollBar1.Scroll
[INDENT]Panel1.HorizontalScroll.Value = HScrollBar1.Value
[/INDENT]
End Sub

Private Sub Panel1_ControlAdded_Removed(ByVal sender As Object, ByVal e As System.Windows.Forms.ControlEventArgs) Handles Panel1.ControlAdded, Panel1.ControlRemoved
[INDENT]If Panel1.HorizontalScroll.Visible = True Then
[INDENT]HScrollBar1.Visible = True
HScrollBar1.Maximum = Panel1.HorizontalScroll.Maximum
HScrollBar1.Minimum = Panel1.HorizontalScroll.Minimum
HScrollBar1.SmallChange = Panel1.HorizontalScroll.SmallChange
HScrollBar1.LargeChange = Panel1.HorizontalScroll.LargeChange[/INDENT]
Else
[INDENT]HScrollBar1.Visible = False[/INDENT]
End If[/INDENT]
End Sub
Not sure if this is the best approach but it worked for me. If anyone has a better solution please feel free to post it.

Hope this is of assistance to anyone trying to do the same thing.
 
Top Bottom