private void Drawable_Paint(object sender, PaintEventArgs e) { var g = e.Graphics; DrawInfo.SetPixelsPerPoint(g); var rec = new Rectangle(0, 0, drawable.Width - 1, DrawInfo.TextHeight + _spacing); var overGroup = false; string prevCategory = null; _separatorPos = Math.Min(Width - _separatorSafeDistance, Math.Max(_separatorSafeDistance, _separatorPos)); _selectedCell = null; g.Clear(DrawInfo.BackColor); foreach (var c in _cells) { rec.Height = c.Height + _spacing; // Draw group if (prevCategory != c.Category) { if (c.Category.Contains("Proc") || Group) { DrawGroup(g, rec, c.Category); prevCategory = c.Category; overGroup |= rec.Contains(_mouseLocation); rec.Y += DrawInfo.TextHeight + _spacing; } } // Draw cell var selected = rec.Contains(_mouseLocation); if (selected) { _selectedCell = c; } c.Draw(g, rec, _separatorPos, selected); // Draw separator for the current row g.FillRectangle(DrawInfo.BorderColor, _separatorPos - 1, rec.Y, 1, rec.Height); rec.Y += c.Height + _spacing; } // Draw separator for not filled rows g.FillRectangle(DrawInfo.BorderColor, _separatorPos - 1, rec.Y, 1, Height); // Set Height var newHeight = Math.Max(rec.Y + 1, Height - 2); if (_height != newHeight) { drawable.Height = _height = newHeight; SetWidth(); } if (overGroup) // TODO: Group collapsing/expanding? { SetCursor(CursorType.Arrow); } else if ((new Rectangle(_separatorPos - _separatorWidth / 2, 0, _separatorWidth, Height)).Contains(_mouseLocation)) { SetCursor(CursorType.VerticalSplit); } else { SetCursor(CursorType.Arrow); } }