Add treelistview custom tree lines (colour/width) and text colour

This commit is contained in:
baldurk
2016-05-27 19:29:49 +02:00
parent 54106a2108
commit a85d11643b
3 changed files with 38 additions and 6 deletions
@@ -996,8 +996,10 @@ namespace TreelistView
int indentSize = GetIndentSize(node) + 5;
cellRect.X += indentSize;
cellRect.Width -= indentSize;
if (ViewOptions.ShowLine)
PaintLines(dc, cellRect, node);
// save rectangle for line drawing below
Rectangle lineCellRect = cellRect;
cellRect.X += lineindet;
cellRect.Width -= lineindet;
@@ -1015,7 +1017,10 @@ namespace TreelistView
Image icon = hoverNode != null && hoverNode == node ? GetHoverNodeBitmap(node) : GetNodeBitmap(node);
PaintCellBackground(dc, cellRect, node, col);
PaintCellBackground(dc, cellRect, node, col);
if (ViewOptions.ShowLine)
PaintLines(dc, lineCellRect, node);
if (SelectedImage != null && (NodesSelection.Contains(node) || FocusedNode == node))
{
@@ -1079,9 +1084,16 @@ namespace TreelistView
Node parent = node.Parent;
while (parent != null)
{
Pen linePen = null;
if (parent.TreeLineColor != Color.Transparent || parent.TreeLineWidth > 0.0f)
linePen = new Pen(parent.TreeLineColor, parent.TreeLineWidth);
cellRect.X -= ViewOptions.Indent;
dc.DrawLine(pen, cellRect.X, cellRect.Top, cellRect.X, cellRect.Bottom);
dc.DrawLine(linePen != null ? linePen : pen, cellRect.X, cellRect.Top, cellRect.X, cellRect.Bottom);
parent = parent.Parent;
if (linePen != null)
linePen.Dispose();
}
pen.Dispose();