private void DrawCell(Graphics g, int index, int x, int y, ByteGroup activeRange) { Rectangle bounds; Color foreColor; Color backColor; int offset; if (activeRange != null) { foreColor = activeRange.ForeColor; backColor = activeRange.BackColor; } else { foreColor = this.ForeColor; backColor = this.BackColor; } offset = _cellSize.Width + _cellOffset; bounds = new Rectangle(x, y, offset, _cellSize.Height); using (Brush brush = new SolidBrush(backColor)) { g.FillRectangle(brush, bounds); if (activeRange != null && index < activeRange.End) { g.FillRectangle(brush, x + offset, y, _cellOffset, _cellSize.Height); } } TextRenderer.DrawText(g, _data[index].ToString("X2"), this.Font, bounds, foreColor, backColor, _flags); if (_highlightedIndex == index) { using (Brush brush = new SolidBrush(Color.FromArgb(128, Color.Firebrick))) { g.FillRectangle(brush, bounds); } } }
public void AddRange(ByteGroup group) { _groups.Add(group); this.Invalidate(); }