Quote Originally Posted by joaquim View Post
"Also I still do not understand why you are using pictureboxes when the Image controls already take care of the transparent color for you and you can overlay Image controls because they are themselves transparent so you don't need the TransparentBlt."
in these case i don't want use the image, speaking on transparency... why, because i want put the complete frame in 1 image
if use it in your way, must show some imagesboxes and hidde others(i belive that it's more complicated).... my objective it's show the frame complete on a single image... in same picturebox
OK, I understand what your purpose is - it's OK to use pictureboxes and then use the TransparentBLt API which will give you your desired results. Now the next thing is to use the pictureboxes correctly and use the TransparentBLt correctly.

So, let's take this one step at a time starting with the halloween gif.

1) All frames have 1 or Leave as the disposal method. So, you leave each frame as is. You
do not need to do anything with them - just leave them alone - believe me this is the correct
way to do it. You simply copy one frame onto the 1st frame and that is all you have to do

2) Before you load a temp.gif into a picturebox make the picturebox backcolor the same as the
transparent color for that frame then load the temp.gif into the picturebox. The transparent color
is RGB(254, 1, 2) or 131582 or &H000201FE&. Later I will show you how to get the transparent color but for now just use the value I posted above.

3) On your TransparentBlt change the last parameter from GetPixel(aimg(i).hdc, 0, 0) to aimg(i).BackColor
You do not need the GetPixel API.

Code:
Select Case fraFrame(i).GCGraphicControl.Disposal
  Case 0    ' No Action
    '
  Case 1    ' Leave
    '
    ' This assumes that you have followed the above steps 1, 2 , and 3
    '
    ' Leave the 1st picturebox as is then take the second picturebox and do this
    '
    'ActualFrame = PreviousFrame + TransparentActualFrame                '
                
    ' I don't know what below does so I will leave it alone
    BitBlt aImg(aImg.Count - 1).hdc, 0, 0, aImg(i - 1).ScaleWidth, aImg(i - 1).ScaleHeight, aImg(i - 1).hdc, 0, 0, vbSrcCopy
       
    ' You dont need the If statement - just use TransparentBlt for everything
         
    'Not Needed--->If fraFrame(i).GCGraphicControl.BackColor <> LSDLogicalScreenDescription.BackColor Then
       
     TransparentBlt aImg(aImg.Count - 1).hdc, _
           fraFrame(i).IDImageDescription.FrameLeft, _
           fraFrame(i).IDImageDescription.FrameTop, _
           aImg(i).ScaleWidth, aImg(i).ScaleHeight, aImg(i).hdc, _
           0, 0, _
           aImg(i).ScaleWidth, aImg(i).ScaleHeight, _
           aImg(i).BackColor
         
    'Not Needed--->Else
    'Not Needed--->  BitBlt aImg(aImg.Count - 1).hdc, fraFrame(i).IDImageDescription.FrameLeft, fraFrame(i).IDImageDescription.FrameTop, aImg(i).ScaleWidth, aImg(i).ScaleHeight, aImg(i).hdc, 0, 0, vbSrcCopy
    'Not Needed--->End If
       
    aImg(i).Picture = aImg(aImg.Count - 1).Image
    aImg(aImg.Count - 1).Cls
  '
  '
  '
End Select
To simplify what I am saying take a look at the following code. I use Picture1(1) as the first picture which is the closed door. Picture1(2) is the second picture that says Ding Dong. I hard coded the X and Y of picture1(1) to be the same as the Picture1(2) offset just for this example. You do the same thing with the other frames always leaving each frame as is - just copy them like below. Note that I have already made the Picture1(2).BackColor = TransparentColor which is RGB(254, 1, 2) or 131582 or &H000201FE& however one you want to use.

Code:
 TransparentBlt Picture1(1).hdc, _
     11, _
     20, _
     Picture1(2).ScaleWidth, _
     Picture1(2).ScaleHeight, _
     Picture1(2).hdc, _
     0, 0, _
     Picture1(2).ScaleWidth, _
     Picture1(2).ScaleHeight, _
     Picture1(2).BackColor