I'm trying to create a bitmap out of the strokes in an inkcanvas but i keep getting an error. I'm not sure why. Ill post the code and what line i keep getting the error at. The error is System.ArgumentException: Parameter is not valid.
at System.Drawing.Bitmap..ctor(Stream stream)
at MeasureTest.Window1.Analyze() in ...\Window1.xaml.vb:line 109
I appreciate any help anyone can give me.
Code:Dim ms As New MemoryStream ink1.Strokes.Save(ms) Dim bits As Byte() = ms.ToArray Dim memorybits As New MemoryStream(bits) Dim bitmap As New System.Drawing.Bitmap(memorybits) 'Error Here ********** Dim bit As BitmapSource = Imaging.CreateBitmapSourceFromHBitmap(bitmap.GetHbitmap, IntPtr.Zero, Int32Rect.Empty, _ BitmapSizeOptions.FromEmptyOptions()) Dim Testimage As New Image Testimage.Source = CType(bit, ImageSource)




Reply With Quote