If the picturebox does not have AutoRedraw=True and is hidden/not visible, you should get just black I would think.
If the picturebox does have AutoRedraw=True and the size is smaller than what you are trying to Blt, you will get only the size of the picturebox, the rest should be black I would think
Now, if PicAnimation(picAnimation.Count-1).AutoRedraw=False, then this is a problem...
If the above isn't the problem, I'm sure this is part of it tooCode:PrintWindow Extender.Container.hwnd, PicAnimation(PicAnimation.Count - 1).hDC, 0 PicAnimation(PicAnimation.Count - 1).Refresh ' << erased without AutoRedraw=True
It is never safe to cache a VB hDC since VB can change it whenever it wants. Try this exampleCode:PicAnimation(PicAnimation.Count - 1).Picture = PicAnimation(PicAnimation.Count - 1).Image s = PicAnimation(PicAnimation.Count - 1).hDC PicAnimation(PicAnimation.Count - 1).Picture = Nothing ' << erased DC ' ^^ if the AutoRedraw = True, the hDC changed, therefore s points to a destroyed hDC
-- add a picturebox to a form & paste this code. Run project & click the picturebox.
See the results. You may be surprised
Code:Private Sub Picture1_Click() Picture1.AutoRedraw = True Picture1.PaintPicture Me.Icon, 0, 0 Debug.Print "hDC before setting picture to image: "; Picture1.hDC Set Picture1.Picture = Picture1.Image Debug.Print "hDC after setting picture to image: "; Picture1.hDC Set Picture1.Picture = Nothing Debug.Print "hDC after setting picture1.picture=nothing: "; Picture1.hDC End Sub




Reply With Quote