diff --git a/DarkUI/Controls/DarkTreeView.cs b/DarkUI/Controls/DarkTreeView.cs index 3c8aef5..bcd104e 100644 --- a/DarkUI/Controls/DarkTreeView.cs +++ b/DarkUI/Controls/DarkTreeView.cs @@ -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); diff --git a/Example/Forms/MainForm.Designer.cs b/Example/Forms/MainForm.Designer.cs index ea60870..05b8134 100644 --- a/Example/Forms/MainForm.Designer.cs +++ b/Example/Forms/MainForm.Designer.cs @@ -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";