private void iconWorker_DoWork(object sender, DoWorkEventArgs e) { IconArgs ia = (IconArgs)e.Argument; ia.icon = IconHandler.IconFromFileName(ia.FullName, IconSize.Small); if (ia.icon == null) { ia.icon = Properties.Resources.error; } e.Result = ia; }
private void iconWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { IconArgs res = (IconArgs)e.Result; if (uiDGVResults.Rows.Count > res.RowIndex) { if (uiDGVResults.Rows[res.RowIndex].Cells[0].Displayed & res.Query == uiTSTxtSearch.Text) { Rectangle rect = uiDGVResults.GetCellDisplayRectangle(0, res.RowIndex, false); g.DrawIconUnstretched(res.icon, rect); } } if (cellsNeeded.Count > 0) { IconArgs arg = cellsNeeded.Pop(); if (uiDGVResults.Rows.Count > arg.RowIndex) { if (uiDGVResults.Rows[arg.RowIndex].Cells[0].Displayed) { iconWorker.RunWorkerAsync(arg); } } } }