[問題] Object is currently in use elsewhere
我有一個用新thread呼叫出來的Form
這個Form的內容是一個picturebox不斷更新視訊的畫面(Bitmap)
現在這個function執行時會隨機出現Exception
訊息是 : Object is curently in use elsewhere
嘗試過用Lock(pictureBox1)一樣無效
請問還有其他方法嗎?
程式碼片段如下 :
private delegate void video_NewFrameDel(object sender, NewFrameEventArgs
eventArgs);
private void video_NewFrame(object sender, NewFrameEventArgs eventArgs)
{
try
{
if (pictureBox1.InvokeRequired)
{
video_NewFrameDel del = new video_NewFrameDel(video_NewFrame);
pictureBox1.BeginInvoke(del, new object[] { sender, eventArgs });
}
else
{
lock (pictureBox1)
{
pictureBox1.Image = (Bitmap)eventArgs.Frame.Clone();
}
}
}
catch (Exception)
{
}
}
--
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 115.66.237.128
推
02/14 01:09, , 1F
02/14 01:09, 1F
推
02/14 01:13, , 2F
02/14 01:13, 2F
→
02/14 01:13, , 3F
02/14 01:13, 3F
→
02/14 01:14, , 4F
02/14 01:14, 4F
→
02/14 18:55, , 5F
02/14 18:55, 5F
→
02/16 10:56, , 6F
02/16 10:56, 6F
推
02/16 20:50, , 7F
02/16 20:50, 7F
→
02/16 20:50, , 8F
02/16 20:50, 8F
C_Sharp 近期熱門文章
PTT數位生活區 即時熱門文章