Fixed Issue 387. The new implementation does not try to start a ring 0 driver that already exists, but could not be opened. It tries to delete the driver and install it new. The driver is now stored temporarily in the application folder. The driver is not correctly removed on system shutdown.
2 using System.Collections.Generic;
5 using Aga.Controls.Properties;
6 using System.Windows.Forms;
7 using System.Windows.Forms.VisualStyles;
9 namespace Aga.Controls.Tree.NodeControls
11 internal class NodePlusMinus : NodeControl
13 public const int ImageSize = 9;
14 public const int Width = 16;
16 private Bitmap _minus;
18 private VisualStyleRenderer _openedRenderer;
19 private VisualStyleRenderer OpenedRenderer
23 if (_openedRenderer == null)
24 _openedRenderer = new VisualStyleRenderer(VisualStyleElement.TreeView.Glyph.Opened);
25 return _openedRenderer;
30 private VisualStyleRenderer _closedRenderer;
31 private VisualStyleRenderer ClosedRenderer
35 if (_closedRenderer == null)
36 _closedRenderer = new VisualStyleRenderer(VisualStyleElement.TreeView.Glyph.Closed);
37 return _closedRenderer;
41 public NodePlusMinus()
43 _plus = Resources.plus;
44 _minus = Resources.minus;
47 public override Size MeasureSize(TreeNodeAdv node, DrawContext context)
49 return new Size(Width, Width);
52 public override void Draw(TreeNodeAdv node, DrawContext context)
56 Rectangle r = context.Bounds;
57 int dy = (int)Math.Round((float)(r.Height - ImageSize) / 2);
58 if (Application.RenderWithVisualStyles)
60 VisualStyleRenderer renderer;
62 renderer = OpenedRenderer;
64 renderer = ClosedRenderer;
65 renderer.DrawBackground(context.Graphics, new Rectangle(r.X, r.Y + dy, ImageSize, ImageSize));
74 context.Graphics.DrawImageUnscaled(img, new Point(r.X, r.Y + dy));
79 public override void MouseDown(TreeNodeAdvMouseEventArgs args)
81 if (args.Button == MouseButtons.Left)
84 if (args.Node.CanExpand)
85 args.Node.IsExpanded = !args.Node.IsExpanded;
89 public override void MouseDoubleClick(TreeNodeAdvMouseEventArgs args)
91 args.Handled = true; // Supress expand/collapse when double click on plus/minus