moel@345: using System; moel@345: using System.Collections.Generic; moel@345: using System.Text; moel@345: using System.Drawing; moel@345: using Aga.Controls.Properties; moel@345: moel@345: namespace Aga.Controls.Tree.NodeControls moel@345: { moel@345: public class NodeStateIcon: NodeIcon moel@345: { moel@345: private Image _leaf; moel@345: private Image _opened; moel@345: private Image _closed; moel@345: moel@345: public NodeStateIcon() moel@345: { moel@345: _leaf = MakeTransparent(Resources.Leaf); moel@345: _opened = MakeTransparent(Resources.Folder); moel@345: _closed = MakeTransparent(Resources.FolderClosed); moel@345: } moel@345: moel@345: private static Image MakeTransparent(Bitmap bitmap) moel@345: { moel@345: bitmap.MakeTransparent(bitmap.GetPixel(0,0)); moel@345: return bitmap; moel@345: } moel@345: moel@345: protected override Image GetIcon(TreeNodeAdv node) moel@345: { moel@345: Image icon = base.GetIcon(node); moel@345: if (icon != null) moel@345: return icon; moel@345: else if (node.IsLeaf) moel@345: return _leaf; moel@345: else if (node.CanExpand && node.IsExpanded) moel@345: return _opened; moel@345: else moel@345: return _closed; moel@345: } moel@345: } moel@345: }