External/Aga.Controls/Tree/NodeControls/NodeStateIcon.cs
author moel.mich
Sun, 23 Sep 2012 18:37:43 +0000
changeset 380 573f1fff48b2
permissions -rw-r--r--
Fixed Issue 387. The new implementation does not try to start a ring 0 driver that already exists, but could not be opened. It tries to delete the driver and install it new. The driver is now stored temporarily in the application folder. The driver is not correctly removed on system shutdown.
     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 }