Allow specifying a background colour per-column on a TreeListNode

This commit is contained in:
baldurk
2014-07-11 22:17:24 +01:00
parent 4ff1355a10
commit 8ef17e41e1
2 changed files with 30 additions and 13 deletions
@@ -26,6 +26,8 @@ namespace TreelistView
Color m_backCol = Color.Transparent;
Color m_defbackCol = Color.Transparent;
Color[] m_backCols = null;
public TreeListView OwnerView = null;
public Node Parent
@@ -146,15 +148,24 @@ namespace TreelistView
get { return m_defbackCol; }
set { m_defbackCol = value; }
}
public Color[] IndexedBackColor
{
get
{
return m_backCols;
}
}
public Node()
{
m_data = new object[1];
}
public Node(string text)
{
m_data = new object[1] {text};
}
public Node()
{
m_data = new object[1];
m_backCols = new Color[1] { Color.Transparent };
}
public Node(string text)
{
m_data = new object[1] { text };
m_backCols = new Color[1] { Color.Transparent };
}
public Node(object[] fields)
{
SetData(fields);
@@ -196,11 +207,14 @@ namespace TreelistView
{
return m_data;
}
public void SetData(object[] fields)
{
m_data = new object[fields.Length];
fields.CopyTo(m_data, 0);
}
public void SetData(object[] fields)
{
m_data = new object[fields.Length];
fields.CopyTo(m_data, 0);
m_backCols = new Color[fields.Length];
for (int i = 0; i < fields.Length; i++) m_backCols[i] = Color.Transparent;
}
public int VisibleNodeCount
{
get
@@ -201,6 +201,9 @@ namespace TreelistView
if (node.BackColor != Color.Transparent)
c = node.BackColor;
if (column.Index < node.IndexedBackColor.Length && node.IndexedBackColor[column.Index] != Color.Transparent)
c = node.IndexedBackColor[column.Index];
if (!m_owner.NodesSelection.Contains(node) && m_owner.FocusedNode != node &&
!(hoverNode == node && m_owner.RowOptions.HoverHighlight) &&