Added mainboard specific configurations for the following Gigabyte mainboards: EX58-UD3R, G41M-Combo, G41MT-S2, G41MT-S2P, GA-MA770T-UD3P, GA-MA785GM-US2H, GA-MA78LM-S2H, GA-MA790X-UD3P, H55-USB3, H55N-USB3, H61M-DS2 REV 1.2, H61M-USB3-B3 REV 2.0, H67A-USB3-B3, P55A-UD3, P67A-UD3-B3, P67A-UD3R-B3, Z68A-D3H-B3, Z68AP-D3, Z68X-UD3H-B3.
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; }