private static void DrawBlockCounter(Graphics g, CellsBlock block, PointF point) { Brush brush = null; Font font = null; GetHeaderStyle(block, out brush, out font); g.DrawString(String.Format("{0,2}", block.Length), font, brush, point); }
public List <CellsBlock> GetCountersList(int?nrow, int?ncol) { List <CellsBlock> list = new List <CellsBlock>(); int limit = 0; int row = 0, col = 0; if (ncol == null) { row = nrow ?? 0; limit = Height; } else if (nrow == null) { col = ncol ?? 0; limit = Width; } limit++; // iterate one more step at the end to count last block CellsBlock currentBlock = null; Element el = null; for (int i = 0; i < limit; i++) { if (i < limit - 1) { if (ncol == null) { el = this[i, row]; } else { el = this[col, i]; } } if (el != null && el.Type == Element.ElementType.Filled) { if (currentBlock == null) { currentBlock = new CellsBlock() { StartPosition = i }; } currentBlock.Length++; el = null; } else if (currentBlock != null) { list.Add(new CellsBlock(currentBlock)); currentBlock = null; } } return(list); }
private static void GetHeaderStyle(CellsBlock block, out Brush brush, out Font font) { if (block.IsOpened && Settings.Default.HighlightHeaders) { brush = BasicTheme.HeaderBrushHighlighted; font = BasicTheme.HeaderFontHighlighted; } else { brush = BasicTheme.HeaderBrush; font = BasicTheme.HeaderFont; } }
public static void CheckBlockOpened(int?row, int?col, CellsBlock block, List <CellsBlock> checkList, DataMatrix dataMatrix) { foreach (CellsBlock checkBlock in checkList) { bool startCleared = IsElementCleared(row, col, (checkBlock.StartPosition - 1), dataMatrix); bool endCleared = IsElementCleared(row, col, (checkBlock.StartPosition + checkBlock.Length), dataMatrix); if (checkBlock.NotCounted && startCleared && endCleared && checkBlock.Length == block.Length) { block.IsOpened = true; checkBlock.NotCounted = false; return; } } block.IsOpened = false; }