Hi, i'im using paintpicture to prevent flickering on my image, but when i do, the white background that wasn't in my image (it was gif with transparent background) is back. How can i get rid of it?
PaintPicture: Draws the contents of a graphics file (.bmp, .wmf, .emf, .ico, or .dib) on a Form, PictureBox, or Printer. Doesn't support named arguments.
Hence it cannot be used to draw *.gif. The best way is to make the gif into an icon, hence it will be retain its transparent properties when drawn on screen.
Yes but u'll need to have a picturebox on the form with the picture (or something with a handle)
From API Guide
VB Code:
'This project needs 2 pictureboxes
'Picturebox1 must contain a picture with a lot of white pixels (we're going to use white as transparent color)
Private Declare Function TransparentBlt Lib "msimg32.dll" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal crTransparent As Long) As Boolean
I made an example but found out it was too slow to draw the picture, so i changed it bit.
You'll need a picturebox with the gif loaded as a picture. This ensures that the gif has a transparent background. Then use
VB Code:
Me.PaintPicture Picture1.Image, 0, 0
You might also need to set the Form's autodraw as true.
Also if you are planning to make a game, i would suggest you check out JR's DirectX tutorial, cause it has an example of image transformations etc which might help. JR's Tutorial