Results 1 to 3 of 3

Thread: Change scroll bar width

  1. #1
    Clint79 is offline VB.NET Forum Newbie
    .NET Framework
    .NET 3.5
    Join Date
    Apr 2010
    Posts
    7
    Reputation
    0

    Change scroll bar width

    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.

  2. #2
    Clint79 is offline VB.NET Forum Newbie
    .NET Framework
    .NET 3.5
    Join Date
    Apr 2010
    Posts
    7
    Reputation
    0

    Question No one can help?

    Over 1000 views and noone can help me out?
    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!

  3. #3
    Clint79 is offline VB.NET Forum Newbie
    .NET Framework
    .NET 3.5
    Join Date
    Apr 2010
    Posts
    7
    Reputation
    0
    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
    
    Panel1.HorizontalScroll.Value = HScrollBar1.Value
    End Sub Private Sub Panel1_ControlAdded_Removed(ByVal sender As Object, ByVal e As System.Windows.Forms.ControlEventArgs) Handles Panel1.ControlAdded, Panel1.ControlRemoved
    If Panel1.HorizontalScroll.Visible = True Then
    HScrollBar1.Visible = True HScrollBar1.Maximum = Panel1.HorizontalScroll.Maximum HScrollBar1.Minimum = Panel1.HorizontalScroll.Minimum HScrollBar1.SmallChange = Panel1.HorizontalScroll.SmallChange HScrollBar1.LargeChange = Panel1.HorizontalScroll.LargeChange
    Else
    HScrollBar1.Visible = False
    End If
    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.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Harvest time tracking