Link to home
Create AccountLog in
Avatar of greenbug2002
greenbug2002

asked on

changing the size of Listview Scrollbars

Hi
I am fairly new to .net so please excuse my ignorance but i am trying to adjust the size of the vertical scroolbars that appear in a listview i just need them bigger as the listview is for a toutchscreen and it will make the user interface easier if they were larger but I cant find how to do this
can someone give me some code please

thanks
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

That would be a very interesting challenge, and I am not sure if it is even possible with the native control.

Bob
I had that problem too with one touchscreen application and I have solved (after I give up try to increase the size of the toolbar) using a VScrollBar that controls the postion of the listview.

The "trick" is to place the VScrollBar over the listview scrollbar and then do something like this:
Me.VScrollBar1.Minimum = 0
Me.VScrollBar1.Maximum = Me.ListView1.Items.Count

And then in the VScrollBar ValueChanged event:
Me.ListView1.Items(VScrollBar1.Value).EnsureVisible()

I'm sure that this is not the best solution but it works really nice!

jpaulino
Avatar of greenbug2002
greenbug2002

ASKER

jpaulino
thanks for the reply
it apperes to work but the scrolling isnt in sync with the listview contence the listview dousnt scrole untill the vscroler is about half way down and then it doust show the full ist

thanks
You're right! I didn't have the project with me and I have looked now. I have used:

Me.VScrollBar1.Maximum = Me.ListView1.Items.Count + 8

Of course 8 is not a value for all solutions. I found this value after some tests and it scrolls until the end.
if there was a way to set the VScrollBar's actual scroller (i meen the gray bar that mooves) to the same length as the VB generated one in the listview that would fix it do you know if thats possable?
>> if there was a way to set the VScrollBar's actual scroller (i meen the gray bar that mooves) to the same length as the VB generated one in the listview that would fix it do you know if thats possable?

I not sure what you want but the gray bar depends of the number of items. If you have 2 it's bit and if you have 1000 is small.
i have placed the Vscrollbar next to listviews intergrated scroller it apperes to be shorter than the listview one check out
http://www.dcwebhosting.co.uk/1.jpg
the is a the same two items four times first therr scrolling down with the vscrollbar the last one scrooling up again with the vscrool bar

thanks for your help with this
Ok, know I understand! Try this:

  Me.VScrollBar1.LargeChange = 30
Ok, now I understand! Try this:

  Me.VScrollBar1.LargeChange = 30
that helped but not quight there yet please see http://www.dcwebhosting.co.uk/2.jpg
But what's your problem with the size? It's supposed to be covering the other one!

The scrollbar from the listview doesn't appear.
it dousnt allow you to scrool through the complete list
ASKER CERTIFIED SOLUTION
Avatar of Jorge Paulino
Jorge Paulino
Flag of Portugal image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
>>You're right! I didn't have the project with me and I have looked now. I have used:
>>Me.VScrollBar1.Maximum = Me.ListView1.Items.Count + 8
>>Of course 8 is not a value for all solutions. I found this value after some tests and it scrolls until the end.

Have you read this ?

Check this small example:
https://filedb.experts-exchange.com/incoming/ee-stuff/6944-ListviewScollBar.zip 
thanks it must be soumthing else in my code you example works perfectly
thanks for your help
Gald I could help and thanks for the grade!

Of course it's not the best solution in the world but ... it works!

jpaulino