Results 1 to 40 of 59

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

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] Class to make Image Controls Support PNG, TIF, GIF Animation

    You have to use the actual height along with the srcY for partial renderring

    Using pixels for example. Let's say the image was 300 pixels in height and you wanted to render 200 of the 300
    SrcY = ActualHeight - SrcY i.e., SrcY = 300 - 200

    I see you have this in a class and are manually converting to/from himetrics. But I'll use ScaleX & ScaleY for easier reading & assume all the parameters are passed in pixels.
    Code:
    .Render (hDC), destX, destY, destWidth, destHeight, _
        srcX, .Height - ScaleY(SrcY, vbPixels, vbHimetric), SrcWidth, -SrcHeight, ByVal 0&
    To prevent unexpected consequences, I'd recommend validating passed source parameters at a minimum & also ensure destination parameters are within reason. Maybe one of the following proves invalid?
    - SrcY + SrcHeight cannot be less than 0 and cannot be > ActualHeight
    - SrcX + SrcWidth cannot be less than 0 and cannot be > ActualWidth
    - SrcHeight & SrcWidth must be between 0 and actual dimensions
    Last edited by LaVolpe; Dec 8th, 2015 at 08:45 AM.
    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