mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
UI fixes, tooltips for fan control
This commit is contained in:
14
app/Fans.Designer.cs
generated
14
app/Fans.Designer.cs
generated
@@ -31,6 +31,7 @@
|
||||
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
|
||||
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea2 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
|
||||
panelFans = new Panel();
|
||||
labelTip = new Label();
|
||||
labelBoost = new Label();
|
||||
comboBoost = new ComboBox();
|
||||
picturePerf = new PictureBox();
|
||||
@@ -73,6 +74,7 @@
|
||||
//
|
||||
// panelFans
|
||||
//
|
||||
panelFans.Controls.Add(labelTip);
|
||||
panelFans.Controls.Add(labelBoost);
|
||||
panelFans.Controls.Add(comboBoost);
|
||||
panelFans.Controls.Add(picturePerf);
|
||||
@@ -89,6 +91,17 @@
|
||||
panelFans.Size = new Size(824, 1159);
|
||||
panelFans.TabIndex = 12;
|
||||
//
|
||||
// labelTip
|
||||
//
|
||||
labelTip.AutoSize = true;
|
||||
labelTip.BackColor = SystemColors.ControlLightLight;
|
||||
labelTip.Location = new Point(245, 13);
|
||||
labelTip.Name = "labelTip";
|
||||
labelTip.Padding = new Padding(5);
|
||||
labelTip.Size = new Size(107, 42);
|
||||
labelTip.TabIndex = 40;
|
||||
labelTip.Text = "500,300";
|
||||
//
|
||||
// labelBoost
|
||||
//
|
||||
labelBoost.AutoSize = true;
|
||||
@@ -468,5 +481,6 @@
|
||||
private PictureBox pictureBox1;
|
||||
private ComboBox comboBoost;
|
||||
private Label labelBoost;
|
||||
private Label labelTip;
|
||||
}
|
||||
}
|
||||
29
app/Fans.cs
29
app/Fans.cs
@@ -1,5 +1,9 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics.Metrics;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Drawing.Text;
|
||||
using System.IO;
|
||||
using System.Windows.Forms.DataVisualization.Charting;
|
||||
|
||||
namespace GHelper
|
||||
@@ -11,6 +15,12 @@ namespace GHelper
|
||||
Series seriesCPU;
|
||||
Series seriesGPU;
|
||||
|
||||
static string ChartPercToRPM(int percentage, string unit = "")
|
||||
{
|
||||
if (percentage == 0) return "OFF";
|
||||
return (1800 + 200 * Math.Floor(percentage * 0.2)).ToString() + unit;
|
||||
}
|
||||
|
||||
void SetChart(Chart chart, int device)
|
||||
{
|
||||
|
||||
@@ -41,10 +51,8 @@ namespace GHelper
|
||||
|
||||
chart.ChartAreas[0].AxisY.LabelStyle.Font = new Font("Arial", 7F);
|
||||
|
||||
chart.ChartAreas[0].AxisY.CustomLabels.Add(-2, 2, "OFF");
|
||||
|
||||
for (int i = 1; i <= 9; i++)
|
||||
chart.ChartAreas[0].AxisY.CustomLabels.Add(i * 10 - 2, i * 10 + 2, (1800 + 400 * i).ToString());
|
||||
for (int i = 0; i <= 90; i += 10)
|
||||
chart.ChartAreas[0].AxisY.CustomLabels.Add(i - 2, i + 2, ChartPercToRPM(i));
|
||||
|
||||
chart.ChartAreas[0].AxisY.CustomLabels.Add(98, 102, "RPM");
|
||||
|
||||
@@ -77,6 +85,9 @@ namespace GHelper
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
labelTip.Visible = false;
|
||||
labelTip.BackColor = Color.Transparent;
|
||||
|
||||
FormClosing += Fans_FormClosing;
|
||||
|
||||
seriesCPU = chartCPU.Series.Add("CPU");
|
||||
@@ -126,7 +137,7 @@ namespace GHelper
|
||||
{
|
||||
int boost = NativeMethods.GetCPUBoost();
|
||||
if (boost >= 0)
|
||||
comboBoost.SelectedIndex = Math.Min(boost,5);
|
||||
comboBoost.SelectedIndex = Math.Min(boost, comboBoost.Items.Count - 1);
|
||||
}
|
||||
|
||||
private void ComboBoost_Changed(object? sender, EventArgs e)
|
||||
@@ -334,6 +345,7 @@ namespace GHelper
|
||||
private void ChartCPU_MouseUp(object? sender, MouseEventArgs e)
|
||||
{
|
||||
curPoint = null;
|
||||
labelTip.Visible = false;
|
||||
}
|
||||
|
||||
private void ChartCPU_MouseMove(object? sender, MouseEventArgs e)
|
||||
@@ -371,13 +383,18 @@ namespace GHelper
|
||||
if (dy < 0) dy = 0;
|
||||
if (dy > 100) dy = 100;
|
||||
|
||||
dymin = (dx - 60) * 1.2;
|
||||
dymin = (dx - 65) * 1.2;
|
||||
|
||||
if (dy < dymin) dy = dymin;
|
||||
|
||||
curPoint.XValue = dx;
|
||||
curPoint.YValues[0] = dy;
|
||||
|
||||
labelTip.Visible = true;
|
||||
labelTip.Text = Math.Round(dx) + "C, " + ChartPercToRPM((int)dy, " RPM");
|
||||
labelTip.Top = e.Y + ((Control)sender).Top;
|
||||
labelTip.Left = e.X;
|
||||
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
4
app/Settings.Designer.cs
generated
4
app/Settings.Designer.cs
generated
@@ -907,7 +907,7 @@ namespace GHelper
|
||||
AutoScaleMode = AutoScaleMode.Dpi;
|
||||
AutoSize = true;
|
||||
AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||
ClientSize = new Size(836, 1173);
|
||||
ClientSize = new Size(830, 1173);
|
||||
Controls.Add(panelFooter);
|
||||
Controls.Add(panelBattery);
|
||||
Controls.Add(panelMatrix);
|
||||
@@ -919,7 +919,7 @@ namespace GHelper
|
||||
MaximizeBox = false;
|
||||
MdiChildrenMinimizedAnchorBottom = false;
|
||||
MinimizeBox = false;
|
||||
MinimumSize = new Size(850, 71);
|
||||
MinimumSize = new Size(830, 71);
|
||||
Name = "SettingsForm";
|
||||
Padding = new Padding(10);
|
||||
ShowIcon = false;
|
||||
|
||||
@@ -987,20 +987,27 @@ namespace GHelper
|
||||
|
||||
}
|
||||
|
||||
private void NoUltimateUI()
|
||||
private void UltimateUI(bool ultimate)
|
||||
{
|
||||
tableGPU.Controls.Remove(buttonUltimate);
|
||||
if (!ultimate)
|
||||
{
|
||||
tableGPU.Controls.Remove(buttonUltimate);
|
||||
|
||||
buttonFans.Image = null;
|
||||
buttonFans.Height = 50;
|
||||
/*
|
||||
* buttonFans.Image = null;
|
||||
buttonFans.Height = 44;
|
||||
*/
|
||||
|
||||
tablePerf.ColumnCount = 0;
|
||||
tableGPU.ColumnCount = 0;
|
||||
|
||||
}
|
||||
|
||||
tablePerf.ColumnCount = 3;
|
||||
tablePerf.ColumnCount = 3;
|
||||
tableGPU.ColumnCount = 0;
|
||||
tableLayoutKeyboard.ColumnCount = 0;
|
||||
tableScreen.ColumnCount = 0;
|
||||
tableLayoutMatrix.ColumnCount = 0;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public int InitGPUMode()
|
||||
@@ -1020,7 +1027,7 @@ namespace GHelper
|
||||
else
|
||||
GpuMode = ASUSWmi.GPUModeStandard;
|
||||
|
||||
if (mux != 1) NoUltimateUI();
|
||||
UltimateUI(mux == 1);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user