From: Cor Ligthert [MVP] on
Kevin,

Maybe is yours better and did I even write the wrong method in my previous
reply.

However I use normally is. (watch typos, I typed most it in this message)

\\\
If openFileDialog1.ShowDialog() = DialogResult.OK Then
picImage.Image = Image.FromFile(openFileDialog1.FileName)
End If
////

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdrawingimageclassfromfiletopic.asp

Have a look at the overloaded method as well.

I hope this helps,

Cor


From: Herfried K. Wagner [MVP] on
"..:: Kevin ::.." <Kevin(a)discussions.microsoft.com> schrieb:
>I have tried with a bmp image and a gif image and the problem is the same
>for
> both formats

BMP doesn't support transparent backcolors at all. Use the code below to
load a transparent GIF file:

\\\
Dim o As New OpenFileDialog()
If o.ShowDialog() = DialogResult.OK Then
Me.PictureBox1.Image = Image.FromFile(o.FileName)
End If
o.Dispose()
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

From: Dennis on
We can set colors in bitmaps to transparent in VB.Net so shouldn't bmp handle
transparent backgrounds if using 32bit bitmaps? I know you are correct
because I've tried saving 32 bit bitmaps with a color transparent and it
doesn't work.

--
Dennis in Houston


"Herfried K. Wagner [MVP]" wrote:

> "..:: Kevin ::.." <Kevin(a)discussions.microsoft.com> schrieb:
> >I have tried with a bmp image and a gif image and the problem is the same
> >for
> > both formats
>
> BMP doesn't support transparent backcolors at all. Use the code below to
> load a transparent GIF file:
>
> \\\
> Dim o As New OpenFileDialog()
> If o.ShowDialog() = DialogResult.OK Then
> Me.PictureBox1.Image = Image.FromFile(o.FileName)
> End If
> o.Dispose()
> ///
>
> --
> M S Herfried K. Wagner
> M V P <URL:http://dotnet.mvps.org/>
> V B <URL:http://classicvb.org/petition/>
>
>
From: Herfried K. Wagner [MVP] on
"Dennis" <Dennis(a)discussions.microsoft.com> schrieb:
> We can set colors in bitmaps to transparent in VB.Net so shouldn't bmp
> handle
> transparent backgrounds if using 32bit bitmaps? I know you are correct
> because I've tried saving 32 bit bitmaps with a color transparent and it
> doesn't work.

You can actually make the bitmap transparent in memory by calling its
'MakeTransparent' method, for example.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>