VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

ListBoxHScroll class (update)

10Tec Company  (5 Submissions)   Custom Controls/Forms/Menus   Visual Basic 5.0   Intermediate   Wed 3rd February 2021

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) (3(3 Vote))

Download ListBoxHScroll class (update)

ListBoxHScroll class (update) Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters