author | sl |
Thu, 01 Jan 2015 23:35:49 +0100 | |
changeset 405 | 5715aefd2bcc |
permissions | -rw-r--r-- |
moel@345 | 1 |
using System; |
moel@345 | 2 |
using System.Collections.Generic; |
moel@345 | 3 |
using System.Text; |
moel@345 | 4 |
using System.Drawing; |
moel@345 | 5 |
using Aga.Controls.Properties; |
moel@345 | 6 |
|
moel@345 | 7 |
namespace Aga.Controls.Tree.NodeControls |
moel@345 | 8 |
{ |
moel@345 | 9 |
public class NodeStateIcon: NodeIcon |
moel@345 | 10 |
{ |
moel@345 | 11 |
private Image _leaf; |
moel@345 | 12 |
private Image _opened; |
moel@345 | 13 |
private Image _closed; |
moel@345 | 14 |
|
moel@345 | 15 |
public NodeStateIcon() |
moel@345 | 16 |
{ |
moel@345 | 17 |
_leaf = MakeTransparent(Resources.Leaf); |
moel@345 | 18 |
_opened = MakeTransparent(Resources.Folder); |
moel@345 | 19 |
_closed = MakeTransparent(Resources.FolderClosed); |
moel@345 | 20 |
} |
moel@345 | 21 |
|
moel@345 | 22 |
private static Image MakeTransparent(Bitmap bitmap) |
moel@345 | 23 |
{ |
moel@345 | 24 |
bitmap.MakeTransparent(bitmap.GetPixel(0,0)); |
moel@345 | 25 |
return bitmap; |
moel@345 | 26 |
} |
moel@345 | 27 |
|
moel@345 | 28 |
protected override Image GetIcon(TreeNodeAdv node) |
moel@345 | 29 |
{ |
moel@345 | 30 |
Image icon = base.GetIcon(node); |
moel@345 | 31 |
if (icon != null) |
moel@345 | 32 |
return icon; |
moel@345 | 33 |
else if (node.IsLeaf) |
moel@345 | 34 |
return _leaf; |
moel@345 | 35 |
else if (node.CanExpand && node.IsExpanded) |
moel@345 | 36 |
return _opened; |
moel@345 | 37 |
else |
moel@345 | 38 |
return _closed; |
moel@345 | 39 |
} |
moel@345 | 40 |
} |
moel@345 | 41 |
} |