Dave
1/19/2005 8:46:00 PM
Scott,
Thanks for the tip. I should have seen that in the NG.
Changed the image format and all is well!!!
Dave
"Scott McChesney" <scott.mcchesneyNOSPAM@us.army.mil> wrote in message
news:ON8BZHl$EHA.2880@TK2MSFTNGP14.phx.gbl...
> It's been mentioned in several posts on this NG that the 16-bit image
> formats in GDI+ don't work. That may be your problem. Have you tried
> switching image formats? The most consistent recommendation I've seen for
> greyscale images is to use one of the indexed formats and build the color
> table to support your image. Other than that, you'll have to bump up to
> the
> 24- or 32-bit formats.
>
> HTH
>
> - Scott
>
> "Dave" <dave@4_rem_ove_scotts.com> wrote in message
> news:uu8JJkk$EHA.1264@TK2MSFTNGP12.phx.gbl...
>> I'm trying to add a single bitmap image as part of a serializable class
>> definition. When trying to save the class to a file I get the following
>> error:
>>
>> A generic error occurred in GDI+.
>>
>> The class definition is something like this:
>>
>> <Serializable()> Public Class myClass : Implements ICloneable
>> Private myStuff as new ArrayList
>> Private myImage as new Bitmap(100,100,
>> Imaging.PixelFormat.Format16bppGrayScale)
>>
>> ' member functions and properties here
>>
>> Public Property Image() as Bitmap
>> Get
>> Return myImage
>> End Get
>> Set(ByVal Value as Bitmap)
>> myImage = Value.Clone()
>> End Set
>> End Property
>> End Class
>>
>> Creating the file is done using:
>>
>> Private Sub cSaveFile(ByVal myData as myClass)
>> Dim fmat as New
>> System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
>> Dim output As System.IO.FileStream
>> Dim output As System.IO.FileStream
>> output = New System.IO.FileStream("myFileName", IO.FileMode.Create,
>> IO.FileAccess.Write)
>> fmat.Serialize(output, myData)
>> output.Close()
>> End Sub
>>
>> Any suggestions are appreciated.
>>
>> Dave
>>
>>
>
>