Atlanta Custom Software Development 

 
   Search        Code/Page
 

User Login
Email

Password

 

Forgot the Password?
Services
» Web Development
» Maintenance
» Data Integration/BI
» Information Management
Programming
  Database
Automation
OS/Networking
Graphics
Links
Tools
» Regular Expr Tester
» Free Tools

Hide and Show a control's scrollbars

Total Hit ( 3228)

Rate this article:     Poor     Excellent 

 Submit Your Question/Comment about this article

Rating


 


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:

Click here to copy the following block
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:

Click here to copy the following block
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.



Submitted By : Nayan Patel  (Member Since : 5/26/2004 12:23:06 PM)

Job Description : He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting.
View all (893) submissions by this author  (Birth Date : 7/14/1981 )


Home   |  Comment   |  Contact Us   |  Privacy Policy   |  Terms & Conditions   |  BlogsZappySys

© 2008 BinaryWorld LLC. All rights reserved.