dcsimg
Login | Register   
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Tip of the Day
Language: VB4/32,VB5,VB6
Expertise: Intermediate
Oct 30, 1999

WEBINAR:

On-Demand

Application Security Testing: An Integral Part of DevOps


Hide and Show a control's scrollbars

Most VB controls don't let you determine whether they should display a scrollbar or not. For example, a VB ListBox control displays a vertical scrollbar only when the number of its items is larger than the number of visible items. If you want to directly control individual scrollbars, you can use the following two API functions:

Private Declare Function ShowScrollBar Lib "user32" (ByVal hwnd As Long, _
    ByVal wBar As Long, ByVal bShow As Long) As Long
Private Const SB_HORZ = 0
Private Const SB_VERT = 1
Private Const SB_BOTH = 3
For example, you can display the vertical scrollbar of a ListBox control, even if the ListBox doesn't contain any item, using this code:

ShowScrollBar List1.hWnd, SB_VERT, True
This trick works with several other controls, e.g. ComboBox and TreeView controls, but not all. For example, while you can add a scrollbar to a ListView control, as soon as VB redraws the control (for example, after adding an item), the original settings are restored.
Francesco Balena
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
×
We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.
Thanks for your registration, follow us on our social networks to keep up-to-date