Transparent image background
Hi,
I am using VB.NET in VS2005 to develop a Windows CE 5.0 application.
I want to display a .gif or .ico or .bmp (basically don't care which) in a picturebox with a transparent background.
It would appear that the CF does not support transparent image backgrounds.
I have spent a few hours searching for a solution to this but to no avail.
The best I can find is a suggestion that I redraw the image setting the background colour equal to the picturebox colour but I don't know how to do this.
Any help appreciated.
Re: Transparent image background
www.openentcf.org sdk has a extended picturebox that has a transparancy feature....
also this link might be of some use
http://samples.gotdotnet.com/quickst...kgndimage.aspx
Re: Transparent image background
Thanks for the reply :thumb:
I have got something going by using a picture box (visible = false) which has the image loaded into it at design time and then drawing the picture box image into a panel at runtime.
VB Code:
Private Sub Panel1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Panel1.Paint
'Draw the picture box image onto the panel image with a transparent background.
Dim g As Graphics = e.Graphics
Dim g_attribute As New System.Drawing.Imaging.ImageAttributes()
Dim destRect As New Rectangle(0, 0, PictureBox1.Image.Width, PictureBox1.Image.Height)
g_attribute.SetColorKey(Color.FromArgb(255, 255, 255), Color.FromArgb(255, 255, 255))
g.DrawImage(PictureBox1.Image, destRect, 0, 0, PictureBox1.Image.Width, PictureBox1.Image.Height, GraphicsUnit.Pixel, g_attribute)
End Sub