Valhalla Legends Archive

Programming => General Programming => Visual Basic Programming => Topic started by: Newby on May 08, 2004, 12:17 AM

Title: ListView question
Post by: Newby on May 08, 2004, 12:17 AM
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.
Title: Re:ListView question
Post by: Eli_1 on May 08, 2004, 03:08 PM
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.
Title: Re:ListView question
Post by: Newby on May 08, 2004, 05:14 PM
Ah, thanks Eli. 240 worked best for me. :)

If anybody has any other ways though it'd be appreciated.
Title: Re:ListView question
Post by: Noodlez on May 08, 2004, 05:51 PM
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).
Title: Re:ListView question
Post by: Eli_1 on May 08, 2004, 06:06 PM
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.
Title: Re:ListView question
Post by: Noodlez on May 08, 2004, 06:07 PM
Change the resolution on your screen and see if it still works.
http://vbnet.mvps.org/code/subclass/lvscrollbars.htm
Title: Re:ListView question
Post by: Eli_1 on May 08, 2004, 06:11 PM
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.
Title: Re:ListView question
Post by: FuzZ on May 26, 2004, 02:53 PM
Quote from: Noodlez on May 08, 2004, 06:07 PM
Change the resolution on your screen and see if it still works.
http://vbnet.mvps.org/code/subclass/lvscrollbars.htm

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)