나는 DSLR 카메라에서 연속 읽기 이미지 스트림을 응용 프로그램으로 개발했습니다. 오류 : 개체가 현재 다른 곳에서 사용되고 있습니다.
this.picLiveView.Image = (System.Drawing.Image)picImage.Clone();
Object is currently in use elsewhere.( at System.Drawing.Image.get_FrameDimensionsList()
at System.Drawing.ImageAnimator.CanAnimate(Image image)
at System.Drawing.ImageAnimator.ImageInfo..ctor(Image image)
at System.Drawing.ImageAnimator.Animate(Image image, EventHandler onFrameChangedHandler)
at System.Windows.Forms.PictureBox.Animate(Boolean animate)
at System.Windows.Forms.PictureBox.Animate()
at System.Windows.Forms.PictureBox.InstallNewImage(Image value, ImageInstallationType installationType)
at System.Windows.Forms.PictureBox.set_Image(Image value)
내가 picLiveView PictureBox 컨트롤이 아직 새 이미지를 받아 들일 준비가 아니라고 생각 :
while (!liveViewExit)
{
// Create a Memory Stream
stream = new IntPtr();
// Get the bitmap image from the DSLR
bmp = GetEvfImage(stream);
if (bmp != null)
{
// Crop the image.
picImage = (System.Drawing.Image)bmp.Clone(new Rectangle(10, 0, 492, 768), bmp.PixelFormat);
try
{
if (picImage != null)
this.picLiveView.Image = (System.Drawing.Image)picImage.Clone();
}
catch (Exception ex)
{
Utility.HandleError(ex);
}
}
}
잠시를 실행 한 후, 나는이 코드 라인이 오류가 있습니다. PictureBox가 아직 사용 중인지 확인하는 방법에 대해 알아보십시오.
// 추가 :
단일 스레드입니다. 나는 picturebox가 while 루프에서 그림 객체를 처리하기에 충분히 빠르지 않다고 생각한다.
[InvalidOperationException - 개체가 현재 다른 곳에서 사용 중입니다 - 빨간색 십자가] (http://stackoverflow.com/questions/1060280/invalidoperationexception-object-is-currently-in-use-elsewhere-red-cross) – John