VB and VBA Users Source Code: Show and Hide Listbox Scroll Bars at Runtime
[
Home
|
Contents
|
Search
|
Reply
| Previous | Next ]
VB/VBA Source Code
Show and Hide Listbox Scroll Bars at Runtime
By:
Andrew Baker
Email (spam proof):
Email the originator of this post
Date:
Saturday, October 07, 2000
Hits:
1653
Category:
Windows API
Article:
The following routines show and hide listbox scroll bars at runtime: Private Declare Function ShowScrollBar Lib "user32" (ByVal hwnd As Long, ByVal wBar As Long, ByVal bShow As Long) As Long 'Purpose : Hides/Shows the Horizontal Scroll bar on a list box 'Inputs : lbListBox Listbox to alter ' bShow If True shows Horizontal Scroll bar, ' else hides bar. 'Outputs : N/A 'Author : Andrew Baker 'Date : 07/10/2000 23:55 'Notes : 'Revisions : Sub ListBoxHorScroll(lbListBox As ListBox, bShow As Boolean) Const SB_HORZ = 0, SB_CTL = 2, SB_BOTH = 3 If bShow Then Call ShowScrollBar(lbListBox.hwnd, SB_HORZ, 1&) Else Call ShowScrollBar(lbListBox.hwnd, SB_HORZ, 0&) End If End Sub 'Purpose : Hides/Shows the Vertical Scroll bar on a list box 'Inputs : lbListBox Listbox to alter ' bShow If True shows Vertical Scroll bar, ' else hides bar. 'Outputs : N/A 'Author : Andrew Baker 'Date : 07/10/2000 23:55 'Notes : 'Revisions : Sub ListBoxVertScroll(lbListBox As ListBox, bShow As Boolean) Const SB_VERT = 1, SB_CTL = 2, SB_BOTH = 3 If bShow Then Call ShowScrollBar(lbListBox.hwnd, SB_VERT, 1&) Else Call ShowScrollBar(lbListBox.hwnd, SB_VERT, 0&) End If End Sub
Terms and Conditions
Support this site
Download a trial version of the Excel Workbook Rebuilder