why transparent Image background is still shown?

saibaba111

New member
Joined
May 15, 2006
Messages
1
Programming Experience
Beginner
Hi all,

I hope someone can help me with this.

I have made transparent gif images using photoshop hoping that when i use them in windows forms picturebox the background won't be visible . They blend with the different backgrounds but still there is a rectangular background around the picture with the same color of the picturebox background. why is this happenning?
And also when I overlap two images I want them to be see through so that the picture beneath is visible.

Thank you all
Sai
 
This post is most suitable for the GDI+/Graphics catagory so it's been moved there.
You should use GDI+ to draw your images. The background of the picturebox is visible because PictureBoxes don't support transparency.
Search this category for GDI+ and it's DrawImage method, read a bit and if you have more questions feel free to ask.
 
VB.NET:
Imports System.Drawing
VB.NET:
Private Sub pctImages_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint

Dim g as graphics = e.graphics

Dim rect As New Rectangle(6, 12, 32, 32)
g.DrawImage(My.Resources.ImageName, rect)

End Sub
that will draw an image that has been added to your projects resources :) hope that helps.

as for transparent images, i would go with PNGs rather than GIFs
 
Back
Top