急!!有关PictureBox --“该对象当前正在其他地方使用”

ssgreat 2006-04-06 09:17:55
这个错误怎么解决:System.InvalidOperationExceptionSystem.InvalidOperationException: 该对象当前正在其他地方使用
---------------------------------------------------------------------------
at System.Drawing.Image.get_FrameDimensionsList()
at System.Drawing.ImageAnimator.CanAnimate(Image image)
at System.Drawing.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.OnPaint(PaintEventArgs pe)
at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)
at System.Windows.Forms.Control.WmPaint(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
-------------------------------------------------------------
这是我在一个线程中使用PictureBox时遇到的问题,我需要不定时地控制PictureBox的显示(PictureBox.Visible),运行一段时间,就会遇到上面的问题。请高手帮忙看看
...全文
1132 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
Knight94 2006-04-12
  • 打赏
  • 举报
回复
参看
http://blog.csdn.net/knight94/archive/2006/03/16/626584.aspx
xzhunter 2006-04-12
  • 打赏
  • 举报
回复
Clone 一个新图片

然后再显示,不要直接显示原图
ssgreat 2006-04-12
  • 打赏
  • 举报
回复
我现在已经发现问题的所在了,是因为我调用的一个图片是由两个图片合成的一个动态图,所以才出问题,但是不知道如何处理这个问题......
关注中..........
ssgreat 2006-04-07
  • 打赏
  • 举报
回复
我试了,但是还是不行,不知道大家还有什么办法么?
ssgreat 2006-04-06
  • 打赏
  • 举报
回复
首先谢谢的提示,我试试看.......
happyhippy 2006-04-06
  • 打赏
  • 举报
回复
"该对象当前正在其他地方使用"
互斥一下应该就行了,线程中使用PictureBox
lock(PictureBox)
{
//你的操作
}

110,571

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧