Results 1 to 40 of 716

Thread: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)

Threaded View

  1. #11

    Thread Starter
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: [vb6]Alpha Image Control (PNG, AniGIFs, TIFF, & more) [5 Oct 2011]

    Control updated today to fix a gradient anomaly, a bonehead mistake, and for enhancements...

    - Added BkgImage property. BkgImage will paint over solid/gradient background (if applies) and under the control's Picture property
    - Added BkgImageStretch property. BkgImage will be clipped in the control or stretched
    - Added AsyncDownloadDoneBkgImg event to support async download of BkgImage
    - Added SetFixedSizeAspect method to enable aspect of fixed-size during runtime
    - Modified main property page to allow insertion of BkgImage
    - Rewrote gradient routine to use GDI+ vs. msimg32.dll
    - Bonehead mistake: last update somehow broke the PrePaint event (mistakenly deleted a line of code)

    Example of layered backgrounds:
    The following image has a gradient background and the new BkgImage property (semi-transparent bubble png) drawn over the gradients, then the actual control's Picture (my avatar) drawn over the BkgImage.
    Name:  bkglayer.PNG
Views: 2739
Size:  51.9 KB
    1. The BkgImage property is limited in how it is drawn. It is either drawn clipped by the control (if applicable) or stretched to the control's dimensions. Since the BkgImage property is a GDIpImage class, you have full access to it for other properties, like setting the ImageIndex and/or segmenting it if desired. If you desire a specifically, run-time, drawn image that is rendered with custom attributes/effects, sizes, etc, you'll want to create a new image and assign it to the BkgImage property; i.e., use SavePictureGDIplus, MergePictureGDIplus or maybe TilePictureGDIplus

    2. The right-side image above was done using the PrePaint event. The PrePaint & PostPaint events will always give you far more control. Sample code looked like this:
    - AlphaImgCtl1 had my avatar in it. WantPrePostEvents property is True
    - AlphaImgCtl2 was hidden and had a 48x48 blue tile in it
    - PrePaint & PostPaint events are runtime events only, so image not displayed as drawn while in design
    Code:
    Private Sub AlphaImgCtl1_PrePaint(hDC As Long, Left As Long, Top As Long, Width As Long, Height As Long, HitTestRgn As Long, Cancel As Boolean)
        Dim xOffset As Long
        If AlphaImgCtl1.Border Then xOffset = 1
        TilePictureGDIplus AlphaImgCtl2.Picture, hDC, xOffset, xOffset, _
            AlphaImgCtl1.ScaleWidth, AlphaImgCtl1.ScaleHeight, _
            AlphaImgCtl2.Picture.Width, AlphaImgCtl2.Picture.Height
    End Sub
    Last edited by LaVolpe; Oct 5th, 2011 at 10:32 PM.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

Tags for this Thread

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