Valhalla Legends Forums Archive | Visual Basic Programming | ListView question

AuthorMessageTime
Newby
Would there be any way to detect if the scroll bars are visible/enabled or not?

That way I could resize my columns according to whether the scroll bar is there or not :).

Any help would be appreciated.
May 8, 2004, 5:17 AM
Eli_1
You might be able to get around that problem some ghetto way. Like:

y = ListView.Height / x
If ListView.ListItems.Count >= y Then
There might be scrollbars, if there isn't, your probably
only off by one.
Else
There's no scrollbars
End If

I tryed to do it after I read this post. I used 220 for 'x' and it seemed to work ok.
May 8, 2004, 8:08 PM
Newby
Ah, thanks Eli. 240 worked best for me. :)

If anybody has any other ways though it'd be appreciated.
May 8, 2004, 10:14 PM
Noodlez
If you plan on distributing the program, I would find a more solid method. As demonstrated, that number is going to change from system to system (for Eli it was 220 for you it was 240).
May 8, 2004, 10:51 PM
Eli_1
No it won't, I just got my number using a guess and check method. His number just happens to be closer -- 240 works better for me also.
May 8, 2004, 11:06 PM
Noodlez
Change the resolution on your screen and see if it still works.
http://vbnet.mvps.org/code/subclass/lvscrollbars.htm
May 8, 2004, 11:07 PM
Eli_1
I tryed that before I posted my answer. First time I did it on 1024x768, and second time I did it on 800x600. The end result never changed.
May 8, 2004, 11:11 PM
FuzZ
[quote author=Noodlez link=board=31;threadid=6695;start=0#msg59096 date=1084057645]
Change the resolution on your screen and see if it still works.
http://vbnet.mvps.org/code/subclass/lvscrollbars.htm
[/quote]

I think it's based on text/icon size, not resolution.

Obviously, if you increase your text size from 9 to 11 it's going to be a larger size. As far as I can tell by reading this and my current knowledge you wouldn't have to worry about it unless you have dynamic font size (which would be nice for different resolutions)
May 26, 2004, 7:53 PM

Search