Results 1 to 40 of 59

Thread: [vb6] Class to make Image Controls Support PNG, TIF, GIF Animation

Threaded View

  1. #17

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

    Re: [vb6] Class to make Image Controls Support PNG, TIF, GIF Animation

    Updated to address a .Render call bug discussed in previous few replies. Changed ASM source also uploaded

    1. The thunk was corrected to allow partial rendering via the VB picture object's .Render method. Does not apply to icons.
    2. The thunk was corrected to allow icons to be rendered at different sizes, i.e., Image control's Stretch property set to True.
    3. Limitation remains... If picture type is icon and class' .IsManaged = True, cannot partially render icons.

    Icons created from this class will not be capable of rendering them partially via the .Render method of the VB picture object, just entire image. They can be rendered at different sizes. Though VB will allow partial rendering, I decided the fix would require a massive rewrite of the subclassing thunk and not worth it. You do have a couple of options though.

    a) After sending an icon to this class to load into a picture object, if the IsManaged property returns true and the .Type property returns vbPicTypeIcon, call the UnManage method. That will release the subclassing and keep the picture as an icon if required, i.e., a hIcon handle. Once unmanaged, you can use the .Render method of the picture object since VB will be rendering it now. You will be stuck with VB's limits in displaying 32 bit alpha blended icons.

    b) If you know you will not need the picture to be an icon, that is, you just want it to be displayed in your project, you can pass the optional RequiredFormat to be vbPicTypeBitmap. This will convert the icon to bitmap, it will not be a hIcon but a hBitmap instead. As a bitmap, you can use the .Render method for partial rendering.

    c) If neither of the above prove acceptable, then you can always take control manually. Whatever DC you will be using in the .Render call, create a clipping region on the DC to prevent any drawing outside the region. Render the image in its entirety, remove the clipping region. This would be the exact same result as partial rendering.
    Last edited by LaVolpe; Dec 14th, 2015 at 06:38 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}

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