Results 1 to 6 of 6

Thread: [VB6 - API] - using bitblt in same picturebox

  1. #1

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,961

    [VB6 - API] - using bitblt in same picturebox

    i build 1 code for put 1 image in 1 picturebox, and until here works fine:
    Code:
    ImageWithControls Extender.Container.hwnd, picGraphicsEffects.hDC
            picGraphicsEffects.Picture = picGraphicsEffects.Image
            Call BitBlt(picGraphicsEffects.hDC, 0, 0, PicAnimation(lngActualSubImage).Width, PicAnimation(lngActualSubImage).Height, picGraphicsEffects.hDC, lngOldPosX, lngOldPosY, vbSrcCopy)
    then i use the bitblt for copy 1 part of that image to the same picturebox. the result of the function is '1'. but i can't see the part of the image
    because the position isn't correct. i know these because i debug it and the position is correct, but the bitblt interpret it by 0. and i don't know why
    can anyone explain to me what isn't right?
    thanks
    Last edited by joaquim; Jul 29th, 2010 at 02:27 PM.
    VB6 2D Sprite control

    To live is difficult, but we do it.

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

    Re: [VB6 - API] - using bitblt in same picturebox

    BitBlt uses pixel not twips. Ensure AutoRedraw=True or picGraphicsEffects is not obstructed. If AutoRedraw is False and you refresh picGraphicsEffects then you erase what you just BitBlt.
    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}

  3. #3

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,961

    Re: [VB6 - API] - using bitblt in same picturebox

    Quote Originally Posted by LaVolpe View Post
    BitBlt uses pixel not twips. Ensure AutoRedraw=True or picGraphicsEffects is not obstructed. If AutoRedraw is False and you refresh picGraphicsEffects then you erase what you just BitBlt.
    Code:
     ImageWithControls Extender.Container.hwnd, picGraphicsEffects.hDC
            picGraphicsEffects.Picture = picGraphicsEffects.Image
            picGraphicsEffects.AutoRedraw = False
            Call BitBlt(picGraphicsEffects.hDC, 0, 0, PicAnimation(lngActualSubImage).Width, PicAnimation(lngActualSubImage).Height, picGraphicsEffects.hDC, lngOldPosX, lngOldPosY, vbSrcCopy)
            picGraphicsEffects.Picture = picGraphicsEffects.Image
            picGraphicsEffects.AutoRedraw = True
    i continue with same problem
    see the image... the opacy works(not in some positions).
    but why that bug?
    Attached Images Attached Images  
    VB6 2D Sprite control

    To live is difficult, but we do it.

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

    Re: [VB6 - API] - using bitblt in same picturebox

    May not matter here, but looks like you have your AutoRedraw True/False reversed:
    Set to true, BitBlt, then set to false after .Picture=.Image

    Also, BitBlt does not transfer transparency.

    The stuff at the very top and very bottom of our bigger image could be related to calculation error.
    Ensure PicAnimation(lngActualSubImage).Width+lngOldPosX is not greater than picGraphicsEffects.ScaleWidth (pixels)
    Ensure PicAnimation(lngActualSubImage).Height+lngOldPosY is not greater than picGraphicsEffects.ScaleHeight (pixels)
    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}

  5. #5

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,961

    Re: [VB6 - API] - using bitblt in same picturebox

    Quote Originally Posted by LaVolpe View Post
    May not matter here, but looks like you have your AutoRedraw True/False reversed:
    Set to true, BitBlt, then set to false after .Picture=.Image

    Also, BitBlt does not transfer transparency.

    The stuff at the very top and very bottom of our bigger image could be related to calculation error.
    Ensure PicAnimation(lngActualSubImage).Width+lngOldPosX is not greater than picGraphicsEffects.ScaleWidth (pixels)
    Ensure PicAnimation(lngActualSubImage).Height+lngOldPosY is not greater than picGraphicsEffects.ScaleHeight (pixels)
    i'm confuse
    i try do some changes that you said, but not with sucess
    VB6 2D Sprite control

    To live is difficult, but we do it.

  6. #6

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,961

    Re: [VB6 - API] - using bitblt in same picturebox

    if the object the scale size is more big than object size, the bitblt can copy what is in scalesize(but not in object size... what i mean is copy what u can't see)?
    VB6 2D Sprite control

    To live is difficult, but we do it.

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