mirror of
https://github.com/mirror/processhacker
synced 2026-06-08 16:03:24 +00:00
b02427417c
git-svn-id: svn://svn.code.sf.net/p/processhacker/code@5614 21ef857c-d57f-4fe0-8362-d861dc6d29cd
42 lines
851 B
C#
42 lines
851 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using System.Drawing;
|
|
using System.Windows.Forms;
|
|
using Aga.Controls.Properties;
|
|
|
|
namespace Aga.Controls.Tree.NodeControls
|
|
{
|
|
public class NodeIcon : BindableControl
|
|
{
|
|
public NodeIcon()
|
|
{
|
|
LeftMargin = 1;
|
|
}
|
|
|
|
public override Size MeasureSize(TreeNodeAdv node, DrawContext context)
|
|
{
|
|
Image image = GetIcon(node);
|
|
if (image != null)
|
|
return image.Size;
|
|
else
|
|
return Size.Empty;
|
|
}
|
|
|
|
public override void Draw(TreeNodeAdv node, DrawContext context)
|
|
{
|
|
Image image = GetIcon(node);
|
|
if (image != null)
|
|
{
|
|
Rectangle r = GetBounds(node, context);
|
|
context.Graphics.DrawImage(image, r.Location);
|
|
}
|
|
}
|
|
|
|
protected virtual Image GetIcon(TreeNodeAdv node)
|
|
{
|
|
return GetValue(node) as Image;
|
|
}
|
|
}
|
|
}
|