private void GameGridCellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { if (_updatingGameGrid) { return; } if (e.ColumnIndex == 3) { e.CellStyle.SelectionBackColor = Color.White; return; } RvFile tRvDir = gameGrid[e.RowIndex]; ReportStatus tDirStat = tRvDir.DirStatus; foreach (RepStatus t1 in RepairStatus.DisplayOrder) { if (tDirStat.Get(t1) <= 0) { continue; } e.CellStyle.BackColor = _displayColor[(int)t1]; e.CellStyle.ForeColor = _fontColor[(int)t1]; if (e.ColumnIndex == 0) { e.CellStyle.SelectionBackColor = _displayColor[(int)t1]; } return; } }
private void UpdateGameGrid(RvFile tDir) { gameGridSource = tDir; _updatingGameGrid = true; ClearGameGrid(); List <RvFile> gameList = new List <RvFile>(); _gameGridColumnXPositions = new int[(int)RepStatus.EndValue]; for (int j = 0; j < tDir.ChildCount; j++) { RvFile tChildDir = tDir.Child(j); if (!tChildDir.IsDir) { continue; } if (txtFilter.Text.Length > 0 && !tChildDir.Name.Contains(txtFilter.Text)) { continue; } ReportStatus tDirStat = tChildDir.DirStatus; bool gCorrect = tDirStat.HasCorrect(); bool gMissing = tDirStat.HasMissing(); bool gUnknown = tDirStat.HasUnknown(); bool gInToSort = tDirStat.HasInToSort(); bool gFixes = tDirStat.HasFixesNeeded(); bool show = chkBoxShowCorrect.Checked && gCorrect && !gMissing && !gFixes; show = show || chkBoxShowMissing.Checked && gMissing; show = show || chkBoxShowFixed.Checked && gFixes; show = show || gUnknown; show = show || gInToSort; show = show || tChildDir.GotStatus == GotStatus.Corrupt; show = show || !(gCorrect || gMissing || gUnknown || gInToSort || gFixes); if (!show) { continue; } gameList.Add(tChildDir); int columnIndex = 0; for (int l = 0; l < RepairStatus.DisplayOrder.Length; l++) { if (l >= 13) { columnIndex = l; } if (tDirStat.Get(RepairStatus.DisplayOrder[l]) <= 0) { continue; } int len = DigitLength(tDirStat.Get(RepairStatus.DisplayOrder[l])) * 7 + 26; if (len > _gameGridColumnXPositions[columnIndex]) { _gameGridColumnXPositions[columnIndex] = len; } columnIndex++; } } int t = 0; for (int l = 0; l < (int)RepStatus.EndValue; l++) { int colWidth = _gameGridColumnXPositions[l]; _gameGridColumnXPositions[l] = t; t += colWidth; } gameGrid = gameList.ToArray(); GameGrid.RowCount = gameGrid.Length; if (GameGrid.RowCount > 0) { GameGrid.Rows[0].Selected = false; } _updatingGameGrid = false; UpdateSelectedGame(); }