mirror of
https://github.com/openhardwaremonitor/openhardwaremonitor
synced 2025-09-02 23:35:29 +00:00
Replaced the SplitContainer with SplitContainerAdv. Now the panels are directly resized and the splitter can be drawn nicely.
This commit is contained in:
133
GUI/MainForm.Designer.cs
generated
133
GUI/MainForm.Designer.cs
generated
@@ -62,7 +62,6 @@ namespace OpenHardwareMonitor.GUI {
|
||||
private void InitializeComponent() {
|
||||
this.components = new System.ComponentModel.Container();
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
|
||||
this.treeView = new Aga.Controls.Tree.TreeViewAdv();
|
||||
this.sensor = new Aga.Controls.Tree.TreeColumn();
|
||||
this.value = new Aga.Controls.Tree.TreeColumn();
|
||||
this.min = new Aga.Controls.Tree.TreeColumn();
|
||||
@@ -101,47 +100,17 @@ namespace OpenHardwareMonitor.GUI {
|
||||
this.hddMenuItem = new System.Windows.Forms.MenuItem();
|
||||
this.helpMenuItem = new System.Windows.Forms.MenuItem();
|
||||
this.aboutMenuItem = new System.Windows.Forms.MenuItem();
|
||||
this.splitContainer = new System.Windows.Forms.SplitContainer();
|
||||
this.plotPanel = new OpenHardwareMonitor.GUI.PlotPanel();
|
||||
this.sensorContextMenu = new System.Windows.Forms.ContextMenu();
|
||||
this.saveFileDialog = new System.Windows.Forms.SaveFileDialog();
|
||||
this.timer = new System.Windows.Forms.Timer(this.components);
|
||||
this.splitContainer = new OpenHardwareMonitor.GUI.SplitContainerAdv();
|
||||
this.treeView = new Aga.Controls.Tree.TreeViewAdv();
|
||||
this.plotPanel = new OpenHardwareMonitor.GUI.PlotPanel();
|
||||
this.splitContainer.Panel1.SuspendLayout();
|
||||
this.splitContainer.Panel2.SuspendLayout();
|
||||
this.splitContainer.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// treeView
|
||||
//
|
||||
this.treeView.BackColor = System.Drawing.SystemColors.Window;
|
||||
this.treeView.Columns.Add(this.sensor);
|
||||
this.treeView.Columns.Add(this.value);
|
||||
this.treeView.Columns.Add(this.min);
|
||||
this.treeView.Columns.Add(this.max);
|
||||
this.treeView.DefaultToolTipProvider = null;
|
||||
this.treeView.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.treeView.DragDropMarkColor = System.Drawing.Color.Black;
|
||||
this.treeView.FullRowSelect = true;
|
||||
this.treeView.GridLineStyle = Aga.Controls.Tree.GridLineStyle.Horizontal;
|
||||
this.treeView.LineColor = System.Drawing.SystemColors.ControlDark;
|
||||
this.treeView.Location = new System.Drawing.Point(0, 0);
|
||||
this.treeView.Model = null;
|
||||
this.treeView.Name = "treeView";
|
||||
this.treeView.NodeControls.Add(this.nodeImage);
|
||||
this.treeView.NodeControls.Add(this.nodeCheckBox);
|
||||
this.treeView.NodeControls.Add(this.nodeTextBoxText);
|
||||
this.treeView.NodeControls.Add(this.nodeTextBoxValue);
|
||||
this.treeView.NodeControls.Add(this.nodeTextBoxMin);
|
||||
this.treeView.NodeControls.Add(this.nodeTextBoxMax);
|
||||
this.treeView.RowHeight = 18;
|
||||
this.treeView.SelectedNode = null;
|
||||
this.treeView.Size = new System.Drawing.Size(386, 488);
|
||||
this.treeView.TabIndex = 0;
|
||||
this.treeView.Text = "treeView";
|
||||
this.treeView.UseColumns = true;
|
||||
this.treeView.NodeMouseDoubleClick += new System.EventHandler<Aga.Controls.Tree.TreeNodeAdvMouseEventArgs>(this.treeView_NodeMouseDoubleClick);
|
||||
this.treeView.Click += new System.EventHandler(this.treeView_Click);
|
||||
//
|
||||
// sensor
|
||||
//
|
||||
this.sensor.Header = "Sensor";
|
||||
@@ -392,34 +361,6 @@ namespace OpenHardwareMonitor.GUI {
|
||||
this.aboutMenuItem.Text = "About";
|
||||
this.aboutMenuItem.Click += new System.EventHandler(this.aboutMenuItem_Click);
|
||||
//
|
||||
// splitContainer
|
||||
//
|
||||
this.splitContainer.Location = new System.Drawing.Point(12, 12);
|
||||
this.splitContainer.Name = "splitContainer";
|
||||
this.splitContainer.Orientation = System.Windows.Forms.Orientation.Horizontal;
|
||||
//
|
||||
// splitContainer.Panel1
|
||||
//
|
||||
this.splitContainer.Panel1.Controls.Add(this.treeView);
|
||||
//
|
||||
// splitContainer.Panel2
|
||||
//
|
||||
this.splitContainer.Panel2.Controls.Add(this.plotPanel);
|
||||
this.splitContainer.Panel2.Cursor = System.Windows.Forms.Cursors.Default;
|
||||
this.splitContainer.Size = new System.Drawing.Size(386, 662);
|
||||
this.splitContainer.SplitterDistance = 488;
|
||||
this.splitContainer.SplitterWidth = 3;
|
||||
this.splitContainer.TabIndex = 3;
|
||||
//
|
||||
// plotPanel
|
||||
//
|
||||
this.plotPanel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
|
||||
this.plotPanel.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.plotPanel.Location = new System.Drawing.Point(0, 0);
|
||||
this.plotPanel.Name = "plotPanel";
|
||||
this.plotPanel.Size = new System.Drawing.Size(386, 171);
|
||||
this.plotPanel.TabIndex = 0;
|
||||
//
|
||||
// saveFileDialog
|
||||
//
|
||||
this.saveFileDialog.DefaultExt = "txt";
|
||||
@@ -433,14 +374,76 @@ namespace OpenHardwareMonitor.GUI {
|
||||
this.timer.Interval = 1000;
|
||||
this.timer.Tick += new System.EventHandler(this.timer_Tick);
|
||||
//
|
||||
// splitContainer
|
||||
//
|
||||
this.splitContainer.Border3DStyle = System.Windows.Forms.Border3DStyle.Raised;
|
||||
this.splitContainer.Color = System.Drawing.SystemColors.Control;
|
||||
this.splitContainer.Cursor = System.Windows.Forms.Cursors.Default;
|
||||
this.splitContainer.Location = new System.Drawing.Point(12, 12);
|
||||
this.splitContainer.Name = "splitContainer";
|
||||
this.splitContainer.Orientation = System.Windows.Forms.Orientation.Horizontal;
|
||||
//
|
||||
// splitContainer.Panel1
|
||||
//
|
||||
this.splitContainer.Panel1.Controls.Add(this.treeView);
|
||||
//
|
||||
// splitContainer.Panel2
|
||||
//
|
||||
this.splitContainer.Panel2.Controls.Add(this.plotPanel);
|
||||
this.splitContainer.Panel2.Cursor = System.Windows.Forms.Cursors.Default;
|
||||
this.splitContainer.Size = new System.Drawing.Size(386, 483);
|
||||
this.splitContainer.SplitterDistance = 354;
|
||||
this.splitContainer.SplitterWidth = 5;
|
||||
this.splitContainer.TabIndex = 3;
|
||||
//
|
||||
// treeView
|
||||
//
|
||||
this.treeView.BackColor = System.Drawing.SystemColors.Window;
|
||||
this.treeView.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.treeView.Columns.Add(this.sensor);
|
||||
this.treeView.Columns.Add(this.value);
|
||||
this.treeView.Columns.Add(this.min);
|
||||
this.treeView.Columns.Add(this.max);
|
||||
this.treeView.DefaultToolTipProvider = null;
|
||||
this.treeView.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.treeView.DragDropMarkColor = System.Drawing.Color.Black;
|
||||
this.treeView.FullRowSelect = true;
|
||||
this.treeView.GridLineStyle = Aga.Controls.Tree.GridLineStyle.Horizontal;
|
||||
this.treeView.LineColor = System.Drawing.SystemColors.ControlDark;
|
||||
this.treeView.Location = new System.Drawing.Point(0, 0);
|
||||
this.treeView.Model = null;
|
||||
this.treeView.Name = "treeView";
|
||||
this.treeView.NodeControls.Add(this.nodeImage);
|
||||
this.treeView.NodeControls.Add(this.nodeCheckBox);
|
||||
this.treeView.NodeControls.Add(this.nodeTextBoxText);
|
||||
this.treeView.NodeControls.Add(this.nodeTextBoxValue);
|
||||
this.treeView.NodeControls.Add(this.nodeTextBoxMin);
|
||||
this.treeView.NodeControls.Add(this.nodeTextBoxMax);
|
||||
this.treeView.RowHeight = 18;
|
||||
this.treeView.SelectedNode = null;
|
||||
this.treeView.Size = new System.Drawing.Size(386, 354);
|
||||
this.treeView.TabIndex = 0;
|
||||
this.treeView.Text = "treeView";
|
||||
this.treeView.UseColumns = true;
|
||||
this.treeView.NodeMouseDoubleClick += new System.EventHandler<Aga.Controls.Tree.TreeNodeAdvMouseEventArgs>(this.treeView_NodeMouseDoubleClick);
|
||||
this.treeView.Click += new System.EventHandler(this.treeView_Click);
|
||||
//
|
||||
// plotPanel
|
||||
//
|
||||
this.plotPanel.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.plotPanel.Location = new System.Drawing.Point(0, 0);
|
||||
this.plotPanel.Name = "plotPanel";
|
||||
this.plotPanel.Size = new System.Drawing.Size(386, 124);
|
||||
this.plotPanel.TabIndex = 0;
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
this.Menu = this.mainMenu;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(410, 686);
|
||||
this.ClientSize = new System.Drawing.Size(418, 596);
|
||||
this.Controls.Add(this.splitContainer);
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.Menu = this.mainMenu;
|
||||
this.Name = "MainForm";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
|
||||
this.Text = "Open Hardware Monitor";
|
||||
@@ -467,7 +470,7 @@ namespace OpenHardwareMonitor.GUI {
|
||||
private Aga.Controls.Tree.NodeControls.NodeTextBox nodeTextBoxValue;
|
||||
private Aga.Controls.Tree.NodeControls.NodeTextBox nodeTextBoxMin;
|
||||
private Aga.Controls.Tree.NodeControls.NodeTextBox nodeTextBoxMax;
|
||||
private System.Windows.Forms.SplitContainer splitContainer;
|
||||
private SplitContainerAdv splitContainer;
|
||||
private PlotPanel plotPanel;
|
||||
private System.Windows.Forms.MenuItem viewMenuItem;
|
||||
private System.Windows.Forms.MenuItem plotMenuItem;
|
||||
|
@@ -100,8 +100,8 @@ namespace OpenHardwareMonitor.GUI {
|
||||
}
|
||||
|
||||
ClientSize = new Size(
|
||||
Utilities.Config.Get("mainForm.Width", ClientSize.Width),
|
||||
Utilities.Config.Get("mainForm.Height", ClientSize.Height));
|
||||
Utilities.Config.Get("mainForm.Width", 470),
|
||||
Utilities.Config.Get("mainForm.Height", 640));
|
||||
|
||||
foreach (TreeColumn column in treeView.Columns)
|
||||
column.Width = Math.Max(20, Math.Min(400,
|
||||
|
78
GUI/PlotPanel.Designer.cs
generated
78
GUI/PlotPanel.Designer.cs
generated
@@ -1,78 +0,0 @@
|
||||
/*
|
||||
|
||||
Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the License.
|
||||
|
||||
The Original Code is the Open Hardware Monitor code.
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Michael Möller <m.moeller@gmx.ch>.
|
||||
Portions created by the Initial Developer are Copyright (C) 2009-2010
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
|
||||
Alternatively, the contents of this file may be used under the terms of
|
||||
either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
of those above. If you wish to allow use of your version of this file only
|
||||
under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
use your version of this file under the terms of the MPL, indicate your
|
||||
decision by deleting the provisions above and replace them with the notice
|
||||
and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
the provisions above, a recipient may use your version of this file under
|
||||
the terms of any one of the MPL, the GPL or the LGPL.
|
||||
|
||||
*/
|
||||
|
||||
namespace OpenHardwareMonitor.GUI {
|
||||
partial class PlotPanel {
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing) {
|
||||
if (disposing && (components != null)) {
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent() {
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// PlotPanel
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
|
||||
this.Name = "PlotPanel";
|
||||
this.Size = new System.Drawing.Size(170, 168);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
|
||||
@@ -44,7 +44,7 @@ using System.Windows.Forms;
|
||||
using OpenHardwareMonitor.Hardware;
|
||||
|
||||
namespace OpenHardwareMonitor.GUI {
|
||||
public partial class PlotPanel : UserControl {
|
||||
public class PlotPanel : UserControl {
|
||||
|
||||
private DateTime now;
|
||||
private List<ISensor> clocks = new List<ISensor>();
|
||||
@@ -65,8 +65,6 @@ namespace OpenHardwareMonitor.GUI {
|
||||
ControlStyles.ResizeRedraw, true);
|
||||
this.UpdateStyles();
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
centerlower = new StringFormat();
|
||||
centerlower.Alignment = StringAlignment.Center;
|
||||
centerlower.LineAlignment = StringAlignment.Near;
|
||||
@@ -236,8 +234,7 @@ namespace OpenHardwareMonitor.GUI {
|
||||
}
|
||||
|
||||
public void SetSensors(List<ISensor> sensors,
|
||||
IDictionary<ISensor, Color> colors)
|
||||
{
|
||||
IDictionary<ISensor, Color> colors) {
|
||||
this.colors = colors;
|
||||
List<ISensor> clocks = new List<ISensor>();
|
||||
List<ISensor> temperatures = new List<ISensor>();
|
||||
|
@@ -1,120 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
150
GUI/SplitContainerAdv.cs
Normal file
150
GUI/SplitContainerAdv.cs
Normal file
@@ -0,0 +1,150 @@
|
||||
/*
|
||||
|
||||
Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the License.
|
||||
|
||||
The Original Code is the Open Hardware Monitor code.
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Michael Möller <m.moeller@gmx.ch>.
|
||||
Portions created by the Initial Developer are Copyright (C) 2009-2010
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
|
||||
Alternatively, the contents of this file may be used under the terms of
|
||||
either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
of those above. If you wish to allow use of your version of this file only
|
||||
under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
use your version of this file under the terms of the MPL, indicate your
|
||||
decision by deleting the provisions above and replace them with the notice
|
||||
and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
the provisions above, a recipient may use your version of this file under
|
||||
the terms of any one of the MPL, the GPL or the LGPL.
|
||||
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace OpenHardwareMonitor.GUI {
|
||||
public class SplitContainerAdv : SplitContainer {
|
||||
|
||||
private int delta = 0;
|
||||
private Border3DStyle border3DStyle = Border3DStyle.Raised;
|
||||
private Color color = SystemColors.Control;
|
||||
|
||||
public SplitContainerAdv()
|
||||
: base() {
|
||||
SetStyle(ControlStyles.ResizeRedraw, true);
|
||||
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
|
||||
SetStyle(ControlStyles.UserPaint, true);
|
||||
SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
|
||||
SetStyle(ControlStyles.ContainerControl, true);
|
||||
UpdateStyles();
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e) {
|
||||
base.OnPaint(e);
|
||||
|
||||
Graphics g = e.Graphics;
|
||||
Rectangle r = SplitterRectangle;
|
||||
using (SolidBrush brush = new SolidBrush(color))
|
||||
g.FillRectangle(brush, r);
|
||||
ControlPaint.DrawBorder3D(g, r, border3DStyle);
|
||||
}
|
||||
|
||||
protected override void OnKeyDown(KeyEventArgs e) {
|
||||
if (!base.IsSplitterFixed) {
|
||||
if (e.KeyData == Keys.Right || e.KeyData == Keys.Down) {
|
||||
SplitterDistance += SplitterIncrement;
|
||||
} else if (e.KeyData == Keys.Left || e.KeyData == Keys.Up) {
|
||||
SplitterDistance -= SplitterIncrement;
|
||||
}
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnMouseDown(MouseEventArgs e) {
|
||||
if (Orientation == Orientation.Vertical) {
|
||||
delta = this.SplitterDistance - e.X;
|
||||
Cursor.Current = Cursors.VSplit;
|
||||
} else {
|
||||
delta = this.SplitterDistance - e.Y;
|
||||
Cursor.Current = Cursors.HSplit;
|
||||
}
|
||||
base.IsSplitterFixed = true;
|
||||
}
|
||||
|
||||
protected override void OnMouseMove(MouseEventArgs e) {
|
||||
if (base.IsSplitterFixed) {
|
||||
if (e.Button == MouseButtons.Left) {
|
||||
if (Orientation == Orientation.Vertical) {
|
||||
if (e.X > 0 && e.X < Width) {
|
||||
SplitterDistance = e.X + delta < 0 ? 0 : e.X + delta;
|
||||
}
|
||||
} else {
|
||||
if (e.Y > 0 && e.Y < Height) {
|
||||
SplitterDistance = e.Y + delta < 0 ? 0 : e.Y + delta;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
base.IsSplitterFixed = false;
|
||||
}
|
||||
Invalidate();
|
||||
} else {
|
||||
if (SplitterRectangle.Contains(e.Location)) {
|
||||
Cursor = Orientation == Orientation.Vertical ?
|
||||
Cursors.VSplit : Cursors.HSplit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnMouseLeave(EventArgs e) {
|
||||
base.OnMouseLeave(e);
|
||||
Cursor = Cursors.Default;
|
||||
}
|
||||
|
||||
protected override void OnMouseUp(MouseEventArgs e) {
|
||||
delta = 0;
|
||||
base.IsSplitterFixed = false;
|
||||
Cursor.Current = Cursors.Default;
|
||||
}
|
||||
|
||||
public Border3DStyle Border3DStyle {
|
||||
get { return border3DStyle; }
|
||||
set {
|
||||
border3DStyle = value;
|
||||
Invalidate(false);
|
||||
}
|
||||
}
|
||||
|
||||
public Color Color {
|
||||
get { return color; }
|
||||
set {
|
||||
color = value;
|
||||
Invalidate(false);
|
||||
}
|
||||
}
|
||||
|
||||
public new bool IsSplitterFixed {
|
||||
get {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@@ -61,6 +61,9 @@
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="GUI\PlotPanel.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="GUI\ReportForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@@ -82,6 +85,9 @@
|
||||
</Compile>
|
||||
<Compile Include="GUI\ResetMinMaxVisitor.cs" />
|
||||
<Compile Include="GUI\SensorNotifyIcon.cs" />
|
||||
<Compile Include="GUI\SplitContainerAdv.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="GUI\SystemTray.cs" />
|
||||
<Compile Include="GUI\StartupManager.cs" />
|
||||
<Compile Include="GUI\TaskScheduler.cs" />
|
||||
@@ -148,12 +154,6 @@
|
||||
<Compile Include="Utilities\IReadOnlyArray.cs" />
|
||||
<Compile Include="Utilities\ListSet.cs" />
|
||||
<Compile Include="Utilities\PInvokeDelegateFactory.cs" />
|
||||
<Compile Include="GUI\PlotPanel.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="GUI\PlotPanel.Designer.cs">
|
||||
<DependentUpon>PlotPanel.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Hardware\CPU\IntelCPU.cs" />
|
||||
<Compile Include="Hardware\CPU\CPUGroup.cs" />
|
||||
@@ -170,10 +170,6 @@
|
||||
<DependentUpon>AboutBox.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="GUI\PlotPanel.resx">
|
||||
<DependentUpon>PlotPanel.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Resources\ati.png">
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Resources\bigng.png" />
|
||||
|
Reference in New Issue
Block a user