Results 1 to 40 of 4215

Thread: CommonControls (Replacement of the MS common controls)

Threaded View

  1. #11

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,742

    Re: CommonControls (Replacement of the MS common controls)

    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:
    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
    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
    ElseIf ButtonPicture.Type = vbPicTypeBitmap Then
        DrawState DIS.hDC, 0, 0, ButtonPicture.Handle, 0, X, Y, CX, CY, DST_BITMAP Or DSS_DISABLED
    End If
    Metafiles were not processed and transparent GIF bitmaps looked ugly.
    Also with the new method the Metafiles with transparency also looks better. (even better than in intrinsic VB controls)
    Last edited by Krool; Jan 29th, 2019 at 05:50 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width