I have a bitmap that is being extracted piecemeal from another file where it has been stored. I can successfully read and iterpret the data and write it out to a file that can be edited/viewed/previewed etc. However, this is not the direction I would like to go.
I already have the entire file in a char() buffer that I write out to a file, but I would prefer to simply put that information directly into a PictureBox or other image control.
Just an FYI, I have to create the header on the fly since it is stripped from the bitmap in the source file .. that is why I write it seperately.
What I am currently doing is saving the file, then reading it into a new bitmap and assigning it to the control. If I could get away from the saving to file step it would be great!
Any help would be appreciated.
I already have the entire file in a char() buffer that I write out to a file, but I would prefer to simply put that information directly into a PictureBox or other image control.
VB.NET:
Private Shared Sub bmpWriteFile(ByVal FileName As String, _
ByRef charHeader As Byte(), _
ByRef charBuff As Byte())
Dim fs As IO.FileStream = New IO.FileStream(FileName, IO.FileMode.Create, IO.FileAccess.Write)
Dim bw As IO.BinaryWriter = New IO.BinaryWriter(fs)
bw.Seek(0, IO.SeekOrigin.Begin)
bw.Write(charHeader)
bw.Write(charBuff)
bw.Close()
fs.Close()
End Sub
Just an FYI, I have to create the header on the fly since it is stripped from the bitmap in the source file .. that is why I write it seperately.
What I am currently doing is saving the file, then reading it into a new bitmap and assigning it to the control. If I could get away from the saving to file step it would be great!
VB.NET:
bmpWriteFile("C:\Temp.bmp", charHEADERBuffer, charBMPBuffer)
Dim bmp As New Bitmap("C:\Temp.bmp")
Me.PictureBox1.Image = bmp
Any help would be appreciated.