使用DBI Schedule控件时,我们遇到了随机崩溃,这是一个甘特图。下面是堆栈跟踪:
************** Exception Text **************
System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
at System.Collections.CollectionBase.System.Collections.IList.get_Item(Int32 index)
at Dbi.WinControl.Schedule.ScheduleCollection.get_Item(Int32 nIndex)
at Dbi.WinControl.Schedule.dbiSchedule.GuideLineBarSnap(Point ptPoint)
at Dbi.WinControl.Schedule.dbiSchedule.MoveAllTimeBar(Point ptPoint, MouseEventArgs e)
at Dbi.WinControl.Schedule.dbiSchedule.OnMouseMove(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseMove(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
其他人有这样的问题吗?
答案 0 :(得分:0)
通过按计划执行以下操作,我的错误出现了:
1.创建预约
2.双击约会(这会启动窗口,允许您执行多项操作,其中一项是删除约会)
3.删除预约
4.节省
5.错误
我认为问题在于,当它通过回调时,时间表控制只跟踪与之关联的索引所使用的约会。删除约会后,它会将回调链向上移动到OnMouseUp事件(类似于OnMouseMove事件)。在用于双击事件的索引上找不到约会时,它会吐出你得到的同样错误。
不幸的是,我的解决方案有点像黑客,但是应用程序需要快速完成并且工作正常:在双击事件中,删除发生后,我添加了一个约会代替旧的,但是我们的标准NULL日期的开始和结束日期(作为一个标志,这只是一个虚拟约会)。然后我重写了OnMouseUp事件,该事件只调用了基类的OnMouseUp事件,然后搜索并删除了虚拟约会。
鉴于您最近在一年前发布此内容,它可能对您没用,但希望它会对某人有所帮助。