This commit is contained in:
seerge
2023-03-11 12:41:34 +01:00
parent 54a4668e2a
commit 9f339806d4
6 changed files with 99 additions and 55 deletions

View File

@@ -4,3 +4,7 @@
<add key="DpiAwareness" value="PerMonitorV2" />
</System.Windows.Forms.ApplicationConfigurationSection>
</configuration>
<appSettings>
<add key="EnableWindowsFormsHighDpiAutoResizing" value="true" />
</appSettings>

128
Fans.Designer.cs generated
View File

@@ -31,13 +31,14 @@
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();
tableFanCharts = new TableLayoutPanel();
chartGPU = new System.Windows.Forms.DataVisualization.Charting.Chart();
chartCPU = new System.Windows.Forms.DataVisualization.Charting.Chart();
checkBoost = new CheckBox();
labelFans = new Label();
checkAuto = new CheckBox();
chartGPU = new System.Windows.Forms.DataVisualization.Charting.Chart();
buttonReset = new Button();
buttonApply = new Button();
chartCPU = new System.Windows.Forms.DataVisualization.Charting.Chart();
panelPower = new Panel();
labelPowerLimits = new Label();
checkApplyPower = new CheckBox();
@@ -54,6 +55,7 @@
pictureFine = new PictureBox();
labelInfo = new Label();
panelFans.SuspendLayout();
tableFanCharts.SuspendLayout();
((System.ComponentModel.ISupportInitialize)chartGPU).BeginInit();
((System.ComponentModel.ISupportInitialize)chartCPU).BeginInit();
panelPower.SuspendLayout();
@@ -66,26 +68,68 @@
//
// panelFans
//
panelFans.Controls.Add(tableFanCharts);
panelFans.Controls.Add(checkBoost);
panelFans.Controls.Add(labelFans);
panelFans.Controls.Add(checkAuto);
panelFans.Controls.Add(chartGPU);
panelFans.Controls.Add(buttonReset);
panelFans.Controls.Add(buttonApply);
panelFans.Controls.Add(chartCPU);
panelFans.Dock = DockStyle.Left;
panelFans.Location = new Point(364, 0);
panelFans.Margin = new Padding(10, 10, 10, 10);
panelFans.Margin = new Padding(0);
panelFans.MinimumSize = new Size(824, 1098);
panelFans.Name = "panelFans";
panelFans.Padding = new Padding(10, 10, 10, 10);
panelFans.Size = new Size(824, 1092);
panelFans.Padding = new Padding(20);
panelFans.Size = new Size(824, 1159);
panelFans.TabIndex = 12;
//
// tableFanCharts
//
tableFanCharts.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
tableFanCharts.ColumnCount = 1;
tableFanCharts.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F));
tableFanCharts.Controls.Add(chartGPU, 0, 1);
tableFanCharts.Controls.Add(chartCPU, 0, 0);
tableFanCharts.Location = new Point(28, 68);
tableFanCharts.Margin = new Padding(6);
tableFanCharts.Name = "tableFanCharts";
tableFanCharts.RowCount = 2;
tableFanCharts.RowStyles.Add(new RowStyle(SizeType.Percent, 50F));
tableFanCharts.RowStyles.Add(new RowStyle(SizeType.Percent, 50F));
tableFanCharts.RowStyles.Add(new RowStyle(SizeType.Absolute, 40F));
tableFanCharts.RowStyles.Add(new RowStyle(SizeType.Absolute, 40F));
tableFanCharts.Size = new Size(764, 988);
tableFanCharts.TabIndex = 36;
//
// chartGPU
//
chartArea1.Name = "ChartArea1";
chartGPU.ChartAreas.Add(chartArea1);
chartGPU.Dock = DockStyle.Fill;
chartGPU.Location = new Point(2, 504);
chartGPU.Margin = new Padding(2, 10, 2, 10);
chartGPU.Name = "chartGPU";
chartGPU.Size = new Size(760, 474);
chartGPU.TabIndex = 17;
chartGPU.Text = "chart1";
//
// chartCPU
//
chartArea2.Name = "ChartArea1";
chartCPU.ChartAreas.Add(chartArea2);
chartCPU.Dock = DockStyle.Fill;
chartCPU.Location = new Point(2, 10);
chartCPU.Margin = new Padding(2, 10, 2, 10);
chartCPU.Name = "chartCPU";
chartCPU.Size = new Size(760, 474);
chartCPU.TabIndex = 14;
chartCPU.Text = "chartCPU";
//
// checkBoost
//
checkBoost.AutoSize = true;
checkBoost.ForeColor = SystemColors.ControlText;
checkBoost.Location = new Point(484, 16);
checkBoost.Location = new Point(475, 18);
checkBoost.Margin = new Padding(4, 2, 4, 2);
checkBoost.Name = "checkBoost";
checkBoost.Size = new Size(320, 36);
@@ -97,7 +141,7 @@
//
labelFans.AutoSize = true;
labelFans.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
labelFans.Location = new Point(24, 16);
labelFans.Location = new Point(28, 20);
labelFans.Margin = new Padding(4, 0, 4, 0);
labelFans.Name = "labelFans";
labelFans.Size = new Size(138, 32);
@@ -108,7 +152,7 @@
//
checkAuto.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
checkAuto.AutoSize = true;
checkAuto.Location = new Point(383, 1030);
checkAuto.Location = new Point(377, 1089);
checkAuto.Margin = new Padding(4, 2, 4, 2);
checkAuto.Name = "checkAuto";
checkAuto.Size = new Size(165, 36);
@@ -116,22 +160,10 @@
checkAuto.Text = "Auto Apply";
checkAuto.UseVisualStyleBackColor = true;
//
// chartGPU
//
chartGPU.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
chartArea1.Name = "ChartArea1";
chartGPU.ChartAreas.Add(chartArea1);
chartGPU.Location = new Point(22, 548);
chartGPU.Margin = new Padding(4, 2, 4, 2);
chartGPU.Name = "chartGPU";
chartGPU.Size = new Size(784, 460);
chartGPU.TabIndex = 16;
chartGPU.Text = "chart1";
//
// buttonReset
//
buttonReset.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
buttonReset.Location = new Point(20, 1024);
buttonReset.Location = new Point(30, 1081);
buttonReset.Margin = new Padding(4, 2, 4, 2);
buttonReset.Name = "buttonReset";
buttonReset.Size = new Size(232, 44);
@@ -142,7 +174,7 @@
// buttonApply
//
buttonApply.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonApply.Location = new Point(550, 1024);
buttonApply.Location = new Point(544, 1081);
buttonApply.Margin = new Padding(4, 2, 4, 2);
buttonApply.Name = "buttonApply";
buttonApply.Size = new Size(248, 44);
@@ -150,18 +182,6 @@
buttonApply.Text = "Apply Fan Curve";
buttonApply.UseVisualStyleBackColor = true;
//
// chartCPU
//
chartCPU.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
chartArea2.Name = "ChartArea1";
chartCPU.ChartAreas.Add(chartArea2);
chartCPU.Location = new Point(22, 66);
chartCPU.Margin = new Padding(10, 10, 10, 10);
chartCPU.Name = "chartCPU";
chartCPU.Size = new Size(780, 460);
chartCPU.TabIndex = 13;
chartCPU.Text = "chartCPU";
//
// panelPower
//
panelPower.Controls.Add(labelPowerLimits);
@@ -174,17 +194,17 @@
panelPower.Controls.Add(labelInfo);
panelPower.Dock = DockStyle.Left;
panelPower.Location = new Point(0, 0);
panelPower.Margin = new Padding(10, 10, 10, 10);
panelPower.Margin = new Padding(10);
panelPower.Name = "panelPower";
panelPower.Padding = new Padding(10, 10, 10, 10);
panelPower.Size = new Size(364, 1092);
panelPower.Padding = new Padding(10);
panelPower.Size = new Size(364, 1159);
panelPower.TabIndex = 13;
//
// labelPowerLimits
//
labelPowerLimits.AutoSize = true;
labelPowerLimits.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
labelPowerLimits.Location = new Point(24, 18);
labelPowerLimits.Location = new Point(24, 20);
labelPowerLimits.Margin = new Padding(4, 0, 4, 0);
labelPowerLimits.Name = "labelPowerLimits";
labelPowerLimits.Size = new Size(229, 32);
@@ -193,9 +213,9 @@
//
// checkApplyPower
//
checkApplyPower.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
checkApplyPower.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
checkApplyPower.AutoSize = true;
checkApplyPower.Location = new Point(32, 982);
checkApplyPower.Location = new Point(29, 1039);
checkApplyPower.Margin = new Padding(4, 2, 4, 2);
checkApplyPower.Name = "checkApplyPower";
checkApplyPower.Size = new Size(165, 36);
@@ -206,7 +226,7 @@
// buttonApplyPower
//
buttonApplyPower.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
buttonApplyPower.Location = new Point(26, 1024);
buttonApplyPower.Location = new Point(24, 1081);
buttonApplyPower.Margin = new Padding(4, 2, 4, 2);
buttonApplyPower.Name = "buttonApplyPower";
buttonApplyPower.Size = new Size(300, 44);
@@ -220,7 +240,7 @@
panelCPU.Controls.Add(label2);
panelCPU.Controls.Add(trackCPU);
panelCPU.Location = new Point(184, 90);
panelCPU.Margin = new Padding(4, 4, 4, 4);
panelCPU.Margin = new Padding(4);
panelCPU.Name = "panelCPU";
panelCPU.Size = new Size(160, 510);
panelCPU.TabIndex = 23;
@@ -267,7 +287,7 @@
panelTotal.Controls.Add(label1);
panelTotal.Controls.Add(trackTotal);
panelTotal.Location = new Point(16, 90);
panelTotal.Margin = new Padding(4, 4, 4, 4);
panelTotal.Margin = new Padding(4);
panelTotal.Name = "panelTotal";
panelTotal.Size = new Size(160, 512);
panelTotal.TabIndex = 22;
@@ -322,10 +342,10 @@
//
// pictureFine
//
pictureFine.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
pictureFine.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
pictureFine.BackgroundImageLayout = ImageLayout.Zoom;
pictureFine.Image = Properties.Resources.everything_is_fine_itsfine;
pictureFine.Location = new Point(20, 666);
pictureFine.Location = new Point(20, 682);
pictureFine.Margin = new Padding(4, 2, 4, 2);
pictureFine.Name = "pictureFine";
pictureFine.Size = new Size(324, 268);
@@ -336,7 +356,7 @@
//
// labelInfo
//
labelInfo.Location = new Point(24, 604);
labelInfo.Location = new Point(24, 618);
labelInfo.Margin = new Padding(4, 0, 4, 0);
labelInfo.Name = "labelInfo";
labelInfo.Size = new Size(320, 330);
@@ -348,13 +368,15 @@
AutoScaleDimensions = new SizeF(192F, 192F);
AutoScaleMode = AutoScaleMode.Dpi;
AutoSize = true;
ClientSize = new Size(1196, 1092);
AutoSizeMode = AutoSizeMode.GrowAndShrink;
ClientSize = new Size(1188, 1159);
Controls.Add(panelFans);
Controls.Add(panelPower);
Margin = new Padding(4, 2, 4, 2);
MaximizeBox = false;
MdiChildrenMinimizedAnchorBottom = false;
MinimizeBox = false;
MinimumSize = new Size(26, 1230);
Name = "Fans";
ShowIcon = false;
ShowInTaskbar = false;
@@ -362,6 +384,7 @@
Text = "Fans and Power";
panelFans.ResumeLayout(false);
panelFans.PerformLayout();
tableFanCharts.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)chartGPU).EndInit();
((System.ComponentModel.ISupportInitialize)chartCPU).EndInit();
panelPower.ResumeLayout(false);
@@ -379,10 +402,8 @@
#endregion
private Panel panelFans;
private CheckBox checkAuto;
private System.Windows.Forms.DataVisualization.Charting.Chart chartGPU;
private Button buttonReset;
private Button buttonApply;
private System.Windows.Forms.DataVisualization.Charting.Chart chartCPU;
private Panel panelPower;
private CheckBox checkApplyPower;
private Button buttonApplyPower;
@@ -398,7 +419,10 @@
private PictureBox pictureFine;
private Label labelInfo;
private Label labelPowerLimits;
private Label labelFans;
private TableLayoutPanel tableFanCharts;
private System.Windows.Forms.DataVisualization.Charting.Chart chartGPU;
private System.Windows.Forms.DataVisualization.Charting.Chart chartCPU;
private CheckBox checkBoost;
private Label labelFans;
}
}

11
Fans.cs
View File

@@ -57,7 +57,18 @@ namespace GHelper
private void Fans_Shown(object? sender, EventArgs e)
{
if (Height > Program.settingsForm.Height)
{
Top = Program.settingsForm.Top + Program.settingsForm.Height - Height;
}
else
{
MinimumSize = new Size(0, Program.settingsForm.Height);
Height = Program.settingsForm.Height;
Top = Program.settingsForm.Top;
}
Left = Program.settingsForm.Left - Width - 5;
}

View File

@@ -99,6 +99,7 @@ namespace GHelper
}
Application.EnableVisualStyles();
trayIcon.MouseClick += TrayIcon_MouseClick; ;

View File

@@ -879,11 +879,14 @@ namespace GHelper
ButtonEnabled(buttonStandard, false);
ButtonEnabled(buttonUltimate, false);
labelGPU.Text = "GPU Mode: Changing ...";
new Thread(() =>
{
Thread.CurrentThread.IsBackground = true;
Program.wmi.DeviceSet(ASUSWmi.GPUEco, eco);
Program.settingsForm.BeginInvoke(delegate {
Program.settingsForm.BeginInvoke(delegate
{
InitGPUMode();
AutoScreen(SystemInformation.PowerStatus.PowerLineStatus);
});

View File

@@ -54,6 +54,7 @@
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<!--<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitor/dpiAwareness>-->
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2, PerMonitor, System</dpiAwareness>
</windowsSettings>
</application>