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.
2 using System.Collections.Generic;
5 using System.Windows.Forms;
6 using Aga.Controls.Properties;
7 using System.ComponentModel;
9 namespace Aga.Controls.Tree.NodeControls
11 public class NodeIcon : BindableControl
18 public override Size MeasureSize(TreeNodeAdv node, DrawContext context)
20 Image image = GetIcon(node);
28 public override void Draw(TreeNodeAdv node, DrawContext context)
30 Image image = GetIcon(node);
33 Rectangle r = GetBounds(node, context);
34 if ( image.Width > 0 && image.Height > 0 )
38 case ImageScaleMode.Fit:
39 context.Graphics.DrawImage(image, r);
41 case ImageScaleMode.ScaleDown:
43 float factor = Math.Min((float)r.Width / (float)image.Width, (float)r.Height / (float)image.Height);
45 context.Graphics.DrawImage(image, r.X, r.Y, image.Width * factor, image.Height * factor);
47 context.Graphics.DrawImage(image, r.X, r.Y, image.Width, image.Height);
49 case ImageScaleMode.ScaleUp:
51 float factor = Math.Max((float)r.Width / (float)image.Width, (float)r.Height / (float)image.Height);
53 context.Graphics.DrawImage(image, r.X, r.Y, image.Width * factor, image.Height * factor);
55 context.Graphics.DrawImage(image, r.X, r.Y, image.Width, image.Height);
57 case ImageScaleMode.AlwaysScale:
59 float fx = (float)r.Width / (float)image.Width;
60 float fy = (float)r.Height / (float)image.Height;
61 if (Math.Min(fx, fy) < 1)
63 float factor = Math.Min(fx, fy);
64 context.Graphics.DrawImage(image, r.X, r.Y, image.Width * factor, image.Height * factor);
66 else if (Math.Max(fx, fy) > 1)
68 float factor = Math.Max(fx, fy);
69 context.Graphics.DrawImage(image, r.X, r.Y, image.Width * factor, image.Height * factor);
72 context.Graphics.DrawImage(image, r.X, r.Y, image.Width, image.Height);
74 case ImageScaleMode.Clip:
76 context.Graphics.DrawImage(image, r.X, r.Y, image.Width, image.Height);
84 protected virtual Image GetIcon(TreeNodeAdv node)
86 return GetValue(node) as Image;
89 private ImageScaleMode _scaleMode = ImageScaleMode.Clip;
90 [DefaultValue("Clip"), Category("Appearance")]
91 public ImageScaleMode ScaleMode
93 get { return _scaleMode; }
94 set { _scaleMode = value; }