グリッドのデータソースを、別のスレッドから更新するBindingSourceオブジェクトにバインドしました。私は次のコードを書きました:
protected override void OnPaint(PaintEventArgs pe)
{
if (this.InvokeRequired)
{
this.Invoke(new OnPaintMethodInvoker(this.OnPaint), pe);
}
else
{
try
{
base.OnPaint(pe);
}
catch
{
}
}
}
そして、2つのことが私に起こります:1。Invokeが呼び出されることはありません(ウルトラグリッドはそれを処理する方法を知っていると思います)2。データが更新されている間に画面で遊んでいるとき(マウスオーバー/サイズ変更)-私は次を受け取ります例外:
インデックスが配列の範囲外だった。
at Infragistics.Shared.SparseArray.GetItemAtScrollIndex(Int32 scrollIndex, ICreateItemCallback createItemCallback)
at Infragistics.Win.UltraWinGrid.ScrollCountManagerSparseArray.GetItemAtScrollIndex(Int32 scrollIndex, Boolean allocate)
at Infragistics.Win.UltraWinGrid.RowsCollection.GetRowAtScrollIndex(Int32 scrollIndex, Boolean allocate)
at Infragistics.Win.UltraWinGrid.RowsCollection.get_IsLastScrollableRowNotAllocatedYet()
at Infragistics.Win.UltraWinGrid.RowScrollRegion.IsLastScrollableRowVisible(ScrollbarVisibility colScrollbarVisibility)
at Infragistics.Win.UltraWinGrid.RowScrollRegion.GetMaxScrollPosition(Boolean scrollToFill)
at Infragistics.Win.UltraWinGrid.RowScrollRegion.EnsureScrollRegionFilled(Boolean calledFromRegenerateVisibleRows)
at Infragistics.Win.UltraWinGrid.RowScrollRegion.RegenerateVisibleRows(Boolean resetScrollInfo)
at Infragistics.Win.UltraWinGrid.RowScrollRegion.RegenerateVisibleRows()
at Infragistics.Win.UltraWinGrid.RowScrollRegion.WillScrollbarBeShown(ScrollbarVisibility assumeColScrollbarsVisible)
at Infragistics.Win.UltraWinGrid.ScrollRegionBase.WillScrollbarBeShown()
at Infragistics.Win.UltraWinGrid.RowScrollRegion.PositionScrollbar(Boolean resetScrollInfo)
at Infragistics.Win.UltraWinGrid.ScrollRegionBase.SetOriginAndExtent(Int32 origin, Int32 extent)
at Infragistics.Win.UltraWinGrid.RowScrollRegion.SetOriginAndExtent(Int32 origin, Int32 extent)
at Infragistics.Win.UltraWinGrid.DataAreaUIElement.ResizeRowScrollRegions()
at Infragistics.Win.UltraWinGrid.DataAreaUIElement.PositionChildElements()
at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive)
at Infragistics.Win.UltraWinGrid.DataAreaUIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive)
at Infragistics.Win.UltraWinGrid.DataAreaUIElement.set_Rect(Rectangle value)
at Infragistics.Win.UltraWinGrid.UltraGridUIElement.PositionChildElements()
at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive)
at Infragistics.Win.UltraWinGrid.UltraGridUIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive)
at Infragistics.Win.UIElement.DrawHelper(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode, Boolean clipText, Boolean forceDrawAsFocused, Boolean preventAlphaBlendGraphics)
at Infragistics.Win.UIElement.Draw(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode, Boolean forceDrawAsFocused, Boolean preventAlphaBlendGraphics)
at Infragistics.Win.ControlUIElementBase.Draw(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode, Size elementSize, Boolean preventAlphaBlendGraphics)
at Infragistics.Win.ControlUIElementBase.Draw(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode, Size elementSize)
at Infragistics.Win.ControlUIElementBase.Draw(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode)
at Infragistics.Win.UltraWinGrid.UltraGridUIElement.Draw(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode)
at Infragistics.Win.UltraControlBase.OnPaint(PaintEventArgs pe)
at Infragistics.Win.UltraWinGrid.UltraGrid.OnPaint(PaintEventArgs pe)
at MyProject.Common.UI.Controls.GridControl.OnPaint(PaintEventArgs pe)
何が問題になるのか誰もが知っていますか?base.OnPaint(pe)の周りにlock(this)を配置しようとしましたが、役に立ちませんでした。