- size_t n, count = children.Count();
- for (n = 0; n < count; ++n)
- PaintLevel(children[n], dc, 1, y);
+ int count = children.Count();
+ if (count > 0)
+ {
+ int n = 0, oldY;
+ do {
+ oldY = y;
+ PaintLevel(children[n], dc, 1, y);
+ } while (++n < count);
+
+ if (!HasFlag(wxTR_NO_LINES) && HasFlag(wxTR_LINES_AT_ROOT) && count > 0)
+ {
+ // draw line down to last child
+ origY += GetLineHeight(children[0])>>1;
+ oldY += GetLineHeight(children[n-1])>>1;
+ dc.DrawLine(3, origY, 3, oldY);
+ }
+ }