VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



ListBoxHScroll class (update)

by 10Tec Company (5 Submissions)
Category: Custom Controls/Forms/Menus
Compatability: Visual Basic 5.0
Difficulty: Intermediate
Date Added: Wed 3rd February 2021
Rating: (3 Votes)

A utility class for adding/hiding the horizontal scroll bar in the ListBox control dynamically taking into account its font (using the IFont interface). The code uses the SendMessage API function to add a horizontal scroll bar dynamically to a list box using the LB_SETHORIZONTALEXTENT message. To precisely calculate the width of a new item, our class uses the DrawText API function with the DT_CALCRECT flag. Draw attention at the fact that our class works properly if you change the font of the listbox as you want. We use the IFont interface and its hFont property to retrieve the handle of the font used in the listbox. Our class can also calculate the minimum width of the list box when the horizontal scroll bar disappears (it takes into account the visibility of the vertical scroll bar in the listbox; it determines whether this scroll bar is present by retrieving the listbox style flags and testing these set of flags for WS_VSCROLL).

Rate ListBoxHScroll class (update)

Download ListBoxHScroll class (update)

Download ListBoxHScroll class (update) (4 KB)

ListBoxHScroll class (update) Comments

No comments have been posted about ListBoxHScroll class (update). Why not be the first to post a comment about ListBoxHScroll class (update).

Post your comment

Subject:
Message:
0/1000 characters