i have 1 code that can Opacy a control(just simulate it) and works fine(except be slow):
my problem here is the bitblt():Code:'the Opacy graphic effect If Opacy > 0 And Opacy <= 100 Then On Error Resume Next picGraphicsEffects.BackColor = UserControl.BackColor picGraphicsEffects.Picture = UserControl.Image UserControl.Picture = Nothing ShowWindow UserControl.HWnd, 0 Load PicAnimation(PicAnimation.Count) 'then create a new picturebox for put the image(with controls(in image way)) from usercontrol container PicAnimation(PicAnimation.Count - 1).Width = Extender.Container.Width PicAnimation(PicAnimation.Count - 1).Height = Extender.Container.Height PrintWindow Extender.Container.HWnd, PicAnimation(PicAnimation.Count - 1).hDC, 0 'these function make the image and put it in the picturebox PicAnimation(PicAnimation.Count - 1).Picture = PicAnimation(PicAnimation.Count - 1).Image picOpacy.Height = UserControl.Height \ Screen.TwipsPerPixelY picOpacy.Width = UserControl.Width \ Screen.TwipsPerPixelX picOpacy.BackColor = lngBackColor BitBlt picOpacy.hDC, 0, 0, UserControl.Width, UserControl.Height, PicAnimation(PicAnimation.Count - 1).hDC, Extender.left \ Screen.TwipsPerPixelX, Extender.top \ Screen.TwipsPerPixelY, vbSrcCopy picOpacy.Refresh picOpacy.Picture = picOpacy.Image TransparentAlphaBlendDIB picGraphicsEffects, picOpacy, CLng(m_Opacy), UserControl.BackColor 'these sub is for plus the image with that background image(picgraphics plus picanimation(picanimation.count-1)) and make it opacy UserControl.Picture = picOpacy.Image ShowWindow UserControl.HWnd, 5 Unload PicAnimation(PicAnimation.Count - 1) 'after these i don't need these picturebox then i delete it End If
why because copy the 0,0 position to picOpacy and not the control position(don't forget the title bar on forms)Code:BitBlt picOpacy.hDC, 0, 0, UserControl.Width, UserControl.Height, PicAnimation(PicAnimation.Count - 1).hDC, Extender.left \ Screen.TwipsPerPixelX, Extender.top \ Screen.TwipsPerPixelY, vbSrcCopy
can anyone advice something?




Reply With Quote