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.
3 This Source Code Form is subject to the terms of the Mozilla Public
4 License, v. 2.0. If a copy of the MPL was not distributed with this
5 file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 Copyright (C) 2009-2010 Michael Möller <mmoeller@openhardwaremonitor.org>
12 using System.Collections.Generic;
14 using System.Windows.Forms;
16 namespace OpenHardwareMonitor.GUI {
17 public class SplitContainerAdv : SplitContainer {
19 private int delta = 0;
20 private Border3DStyle border3DStyle = Border3DStyle.Raised;
21 private Color color = SystemColors.Control;
23 public SplitContainerAdv()
25 SetStyle(ControlStyles.ResizeRedraw, true);
26 SetStyle(ControlStyles.AllPaintingInWmPaint, true);
27 SetStyle(ControlStyles.UserPaint, true);
28 SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
29 SetStyle(ControlStyles.ContainerControl, true);
33 protected override void OnPaint(PaintEventArgs e) {
36 Graphics g = e.Graphics;
37 Rectangle r = SplitterRectangle;
38 using (SolidBrush brush = new SolidBrush(color))
39 g.FillRectangle(brush, r);
40 ControlPaint.DrawBorder3D(g, r, border3DStyle);
43 protected override void OnKeyDown(KeyEventArgs e) {
44 if (!base.IsSplitterFixed) {
45 if (e.KeyData == Keys.Right || e.KeyData == Keys.Down) {
46 SplitterDistance += SplitterIncrement;
47 } else if (e.KeyData == Keys.Left || e.KeyData == Keys.Up) {
48 SplitterDistance -= SplitterIncrement;
54 protected override void OnMouseDown(MouseEventArgs e) {
55 if (Orientation == Orientation.Vertical) {
56 delta = this.SplitterDistance - e.X;
57 Cursor.Current = Cursors.VSplit;
59 delta = this.SplitterDistance - e.Y;
60 Cursor.Current = Cursors.HSplit;
62 base.IsSplitterFixed = true;
65 protected override void OnMouseMove(MouseEventArgs e) {
66 if (base.IsSplitterFixed) {
67 if (e.Button == MouseButtons.Left) {
68 if (Orientation == Orientation.Vertical) {
69 if (e.X > 0 && e.X < Width) {
70 SplitterDistance = e.X + delta < 0 ? 0 : e.X + delta;
73 if (e.Y > 0 && e.Y < Height) {
74 SplitterDistance = e.Y + delta < 0 ? 0 : e.Y + delta;
78 base.IsSplitterFixed = false;
82 if (SplitterRectangle.Contains(e.Location)) {
83 Cursor = Orientation == Orientation.Vertical ?
84 Cursors.VSplit : Cursors.HSplit;
89 protected override void OnMouseLeave(EventArgs e) {
91 Cursor = Cursors.Default;
94 protected override void OnMouseUp(MouseEventArgs e) {
96 base.IsSplitterFixed = false;
97 Cursor.Current = Cursors.Default;
100 public Border3DStyle Border3DStyle {
101 get { return border3DStyle; }
103 border3DStyle = value;
109 get { return color; }
116 public new bool IsSplitterFixed {