External/Aga.Controls/Tree/NodeControls/NodeStateIcon.cs
author StephaneLenclud
Thu, 18 Apr 2013 23:25:10 +0200
branchMiniDisplay
changeset 444 9b09e2ee0968
permissions -rw-r--r--
Front View plug-in does not init if no sensor added.
Fixing some format to make strings shorter.
Now trying to start SoundGraphAccess.exe process from same directory.
Packed mode now can display three sensors along with the current time.
     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 }