|
-
Sep 13th, 2020, 08:02 AM
#11
Re: CommonControls (Replacement of the MS common controls)
 Originally Posted by Nouyana
Krool, please help me figure out how the ListBackColor and IntegralHeight properties work. I tried to use them with different operating systems and with different font sizes. There were no effect.
The ListBackColor is only in effect when the UseListBackColor property is set to True. (will return list back color brush on WM_CTLCOLORLISTBOX only when UseListBackColor is True, default is False)
What you mean with IntegralHeight ?
I think you mix up things. MSDN says about CBS_NOINTEGRALHEIGHT (equivalent of .IntegralHeight = False then CBS_NOINTEGRALHEIGHT is set)
Specifies that the size of the combo box is exactly the size specified by the application when it created the combo box. Normally, the system sizes a combo box so that it does not display partial items.
That means the Height (!) of the drop-down list box area, not the width.
If you want to have the big size text fit into the drop-down area then try:
A) .HorizontalExtent = .GetIdealHorizontalExtent()
B) .DropDownWidth = .GetIdealHorizontalExtent() + Me.ScaleX(4, vbPixels, Me.ScaleMode) ' small extra buffer to account border widths etc.
Option A) uses CB_SETHORIZONTALEXTEND API.
MSDN: If the width of the list box is smaller than this value, the horizontal scroll bar horizontally scrolls items in the list box. If the width of the list box is equal to or greater than this value, the horizontal scroll bar is hidden or, if the combo box has the CBS_DISABLENOSCROLL style, disabled.
You can use the .DisableNoScroll property to control whether CBS_DISABLENOSCROL is set or not.
Option B) uses CB_SETDROPPEDWIDTH API.
MSDN: By default, the minimum allowable width of the drop-down list box is zero. The width of the list box is either the minimum allowable width or the combo box width, whichever is larger.
The .GetIdealHorizontalExtent() function is a convenient wrapper which calculates the "best" width, accounting possible WS_VSCROLL style and testing the string widths using the selected font.
Last edited by Krool; Sep 13th, 2020 at 08:06 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|