UI fixes, tooltips for fan control

This commit is contained in:
seerge
2023-03-18 17:57:09 +01:00
parent 5767320437
commit c50c1807ca
4 changed files with 54 additions and 16 deletions

14
app/Fans.Designer.cs generated
View File

@@ -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;
}
}

View File

@@ -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
{

View File

@@ -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;

View File

@@ -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);
}