K
Kirk Quinbar
hi,
I have the following sample .NET 1.0 code which converts a metafile to a
bitmap:
Dim tmpImage As Bitmap 'System.Drawing.Image
Dim streamX As New System.IO.MemoryStream()
Dim fs As FileStream, br As BinaryReader
Dim FilePath As String
Dim data() As Byte
FilePath = Application.StartupPath & "\computer.wmf"
streamX = New MemoryStream()
fs = New FileStream(FilePath, FileMode.Open, FileAccess.Read,
FileShare.Read)
br = New BinaryReader(fs)
data = br.ReadBytes(500000)
streamX.Write(data, 0, data.GetLength(0))
tmpImage = New Bitmap(streamX)
Dim outImage As Bitmap = New Bitmap(tmpImage)
outImage.SetResolution(200, 200)
PictureBox1.Image = outImage
I am running under WindowsXP and this code worked perfect before I installed
Service Pack 2 for WindowsXP. Now I get an error in the line tmpImage = New
Bitmap(streamX). The error is "Invalid Parameter Used" and that's it.
Has anyone ever experienced this? I am wondering if this is a new bug
introduced by the Service Pack or did they change something so that WMF
files can't be streamed to a bitmap. I can get this same code to work fine
using a JPG or a GIF, so this error is specific to using a WMF, but in my
situation we'd prefer to use a WMF
Kirk Quinbar
Zywave, Inc.
I have the following sample .NET 1.0 code which converts a metafile to a
bitmap:
Dim tmpImage As Bitmap 'System.Drawing.Image
Dim streamX As New System.IO.MemoryStream()
Dim fs As FileStream, br As BinaryReader
Dim FilePath As String
Dim data() As Byte
FilePath = Application.StartupPath & "\computer.wmf"
streamX = New MemoryStream()
fs = New FileStream(FilePath, FileMode.Open, FileAccess.Read,
FileShare.Read)
br = New BinaryReader(fs)
data = br.ReadBytes(500000)
streamX.Write(data, 0, data.GetLength(0))
tmpImage = New Bitmap(streamX)
Dim outImage As Bitmap = New Bitmap(tmpImage)
outImage.SetResolution(200, 200)
PictureBox1.Image = outImage
I am running under WindowsXP and this code worked perfect before I installed
Service Pack 2 for WindowsXP. Now I get an error in the line tmpImage = New
Bitmap(streamX). The error is "Invalid Parameter Used" and that's it.
Has anyone ever experienced this? I am wondering if this is a new bug
introduced by the Service Pack or did they change something so that WMF
files can't be streamed to a bitmap. I can get this same code to work fine
using a JPG or a GIF, so this error is specific to using a WMF, but in my
situation we'd prefer to use a WMF
Kirk Quinbar
Zywave, Inc.