External/Aga.Controls/Tree/NodeControls/NodeStateIcon.cs
author moel.mich
Sun, 27 May 2012 16:08:54 +0000
changeset 346 f652ab1e06e2
permissions -rw-r--r--
Added the small modifications to the Aga.Controls required by the Open Hardware Monitor.
     1 using System;
     2 using System.Collections.Generic;
     3 using System.Text;
     4 using System.Drawing;
     5 using Aga.Controls.Properties;
     6 
     7 namespace Aga.Controls.Tree.NodeControls
     8 {
     9 	public class NodeStateIcon: NodeIcon
    10 	{
    11 		private Image _leaf;
    12 		private Image _opened;
    13 		private Image _closed;
    14 
    15 		public NodeStateIcon()
    16 		{
    17 			_leaf = MakeTransparent(Resources.Leaf);
    18 			_opened = MakeTransparent(Resources.Folder);
    19 			_closed = MakeTransparent(Resources.FolderClosed);
    20 		}
    21 
    22 		private static Image MakeTransparent(Bitmap bitmap)
    23 		{
    24 			bitmap.MakeTransparent(bitmap.GetPixel(0,0));
    25 			return bitmap;
    26 		}
    27 
    28 		protected override Image GetIcon(TreeNodeAdv node)
    29 		{
    30 			Image icon = base.GetIcon(node);
    31 			if (icon != null)
    32 				return icon;
    33 			else if (node.IsLeaf)
    34 				return _leaf;
    35 			else if (node.CanExpand && node.IsExpanded)
    36 				return _opened;
    37 			else
    38 				return _closed;
    39 		}
    40 	}
    41 }