There are a number of useful functions that are missing in the .NET Framework
CE. To make the most of the limited resources on mobile devices only subset of
the .NET Framework have been included. The Save and FromFile
functions are missing. There are 2 good examples how to do this in C# but
I have not found any examples how to do this in VB. Therefore this article
describes how to save and Load Bitmaps in VB.NET on a Pocket
PC.
There are a number of features in C# that are not so easily converted to VB. So rather than translate everything into VB and have 2 versions to control I have just included the C# example from Microsoft as a sub project. This is done by following this recipe:


Imports ImageEditor
To save the bitmap
SaveFileDialog1.Filter = "Bitmap files (*.bmp)|*.bmp"
If SaveFileDialog1.ShowDialog() = DialogResult.OK Then
Me.pDrawWindow.Refresh()
ImageEditor.BitmapFile.SaveToFile(Me.pDrawWindow,
SaveFileDialog1.FileName, 16, Me.bitmap.Width, Me.bitmap.Height)
End If
To load the bitmap
OpenFileDialog1.Filter = "Bitmap files (*.bmp)|*.bmp"
If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
Application.DoEvents()
Cursor.Current = Cursors.WaitCursor
Dim s As Stream = File.OpenRead(OpenFileDialog1.FileName)
Me.bitmap = New Bitmap(s)
s.Close()
Me.pDrawWindow.Invalidate()
Cursor.Current = Cursors.Default
End If
This method is really slow and I would not recommend that this be used. I have included it because it shows the performance benefits of using P/Invoke in the previous examples. This based on a C# example from an example from here
| You must Sign In to use this message board. | |||||||||||
|
|||||||||||
|
|||||||||||
|
|||||||||||