Update released. (phase 1 of 2 concerning StdPicture rendering improvement)
Improved BitmapHandleFromPicture function. (internal function used by various controls, e.g. ListView)
It now also draws the BackColor parameter for non-icons.
This has the advantage that transparent GIF bitmaps and metafiles look better for example in the ListView.
ListView can only handle bitmaps. That was the sense of BitmapHandleFromPicture to return a bitmap from whatever picture format.
Also a change CommandButtonW/CheckBoxW/OptionButtonW concerning drawing of disabled pictures in vbButtonGraphical style. (in case no explicit DisabledPicture property is set)
To draw disabled state from a normal picture the three controls use DrawState API.
Now they use the improved BitmapHandleFromPicture function to better draw non-icons:
previously the code block looked as following:Code:If ButtonPicture.Type = vbPicTypeIcon Then DrawState DIS.hDC, 0, 0, ButtonPicture.Handle, 0, X, Y, CX, CY, DST_ICON Or DSS_DISABLED Else Dim hImage As Long hImage = BitmapHandleFromPicture(ButtonPicture, vbWhite) ' The DrawState API with DSS_DISABLED will draw white as transparent. ' This will ensure GIF bitmaps or metafiles are better drawn. DrawState DIS.hDC, 0, 0, hImage, 0, X, Y, CX, CY, DST_BITMAP Or DSS_DISABLED DeleteObject hImage End If
Metafiles were not processed and transparent GIF bitmaps looked ugly.Code:If ButtonPicture.Type = vbPicTypeIcon Then DrawState DIS.hDC, 0, 0, ButtonPicture.Handle, 0, X, Y, CX, CY, DST_ICON Or DSS_DISABLED ElseIf ButtonPicture.Type = vbPicTypeBitmap Then DrawState DIS.hDC, 0, 0, ButtonPicture.Handle, 0, X, Y, CX, CY, DST_BITMAP Or DSS_DISABLED End If
Also with the new method the Metafiles with transparency also looks better. (even better than in intrinsic VB controls)




Reply With Quote