vb.net 中picturebox显示相机的vido,发生GDI一般性错误,代码如下,求大神帮看看

Public Sub OnImageGrabbed(ByVal sender As Object, ByVal e As ImageGrabbedEventArgs)
Try
If exitcamera = False Then
Dim grabResult As IGrabResult = e.GrabResult
If grabResult.IsValid Then
'将图像数据转换成Bitmap数据
bitmap = New Bitmap(grabResult.Width, grabResult.Height, PixelFormat.Format32bppRgb)
Dim bmpData As BitmapData
bmpData = bitmap.LockBits(New Rectangle(0, 0, bitmap.Width, bitmap.Height), ImageLockMode.ReadWrite, bitmap.PixelFormat)
converter.OutputPixelFormat = PixelType.BGRA8packed
Dim ptrBmp As IntPtr
ptrBmp = bmpData.Scan0
converter.Convert(ptrBmp, bmpData.Stride * bitmap.Height, grabResult)
bitmap.UnlockBits(bmpData)
Dim bitmapOld As Bitmap
bitmapOld = PictureBox1.Image
bitmap.RotateFlip(RotateFlipType.Rotate90FlipNone)
PictureBox1.Image = bitmap
'PictureBox1.Image.RotateFlip(RotateFlipType.Rotate180FlipNone)
If Not (bitmapOld Is Nothing) Then
bitmapOld.Dispose() '释放数据
Else

                End If
            End If
        End If
    Catch ex As Exception
        MsgBox(ex.Message)

    End Try
End Sub

        在旋转90度处会发生GDI一般性错误后 bitmap = New Bitmap(grabResult.Width, grabResult.Height, Pix elFormat.Format32bppR参数变无效,pictureox1有一个子picturebox3,
         PictureBox3.BackColor = Color.Transparent
    PictureBox3.Parent = PictureBox1
            我是要在picturebox3中画图形,鼠标move事件画直线停留久就会发生上面的现象。
            小白求解是哪里出问题了?

http://blog.csdn.net/arashif/article/details/23760899