Added 'ShowIcons' property to DarkTreeView

This commit is contained in:
Robin 2015-09-18 13:24:05 +01:00
parent bd776d5013
commit 6d794dcb52
2 changed files with 12 additions and 2 deletions

View File

@ -125,6 +125,11 @@ namespace DarkUI
[DefaultValue(false)]
public bool AllowMoveNodes { get; set; }
[Category("Appearance")]
[Description("Determines whether icons are rendered with the tree nodes.")]
[DefaultValue(false)]
public bool ShowIcons { get; set; }
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public int VisibleNodeCount { get; private set; }
@ -624,7 +629,11 @@ namespace DarkUI
node.ExpandArea = new Rectangle(indent + 3, expandTop, _expandAreaSize, _expandAreaSize);
var iconTop = yOffset + (ItemHeight / 2) - (_iconSize / 2);
node.IconArea = new Rectangle(node.ExpandArea.Right + 2, iconTop, _iconSize, _iconSize);
if (ShowIcons)
node.IconArea = new Rectangle(node.ExpandArea.Right + 2, iconTop, _iconSize, _iconSize);
else
node.IconArea = new Rectangle(node.ExpandArea.Right, iconTop, 0, 0);
using (var g = CreateGraphics())
{
@ -1241,7 +1250,7 @@ namespace DarkUI
}
// 3. Draw icon
if (node.Icon != null)
if (ShowIcons && node.Icon != null)
{
if (node.Expanded && node.ExpandedIcon != null)
g.DrawImageUnscaled(node.ExpandedIcon, node.IconArea.Location);

View File

@ -649,6 +649,7 @@
this.darkTreeView1.Location = new System.Drawing.Point(1, 25);
this.darkTreeView1.MultiSelect = true;
this.darkTreeView1.Name = "darkTreeView1";
this.darkTreeView1.ShowIcons = true;
this.darkTreeView1.Size = new System.Drawing.Size(219, 198);
this.darkTreeView1.TabIndex = 0;
this.darkTreeView1.Text = "darkTreeView1";