From 9f339806d44a9fc1fe653b14fa532a0627fb40a2 Mon Sep 17 00:00:00 2001 From: seerge Date: Sat, 11 Mar 2023 12:41:34 +0100 Subject: [PATCH] UI Fixes --- App.config | 6 ++- Fans.Designer.cs | 128 ++++++++++++++++++++++++++++------------------- Fans.cs | 13 ++++- Program.cs | 1 + Settings.cs | 5 +- app.manifest | 1 + 6 files changed, 99 insertions(+), 55 deletions(-) diff --git a/App.config b/App.config index 6ee0905e..2116589c 100644 --- a/App.config +++ b/App.config @@ -3,4 +3,8 @@ - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/Fans.Designer.cs b/Fans.Designer.cs index 7cac9dc6..1b809d58 100644 --- a/Fans.Designer.cs +++ b/Fans.Designer.cs @@ -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; } } \ No newline at end of file diff --git a/Fans.cs b/Fans.cs index fd5ebb5b..3812f33a 100644 --- a/Fans.cs +++ b/Fans.cs @@ -57,7 +57,18 @@ namespace GHelper private void Fans_Shown(object? sender, EventArgs e) { - Top = Program.settingsForm.Top; + 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; } diff --git a/Program.cs b/Program.cs index d16371c1..b3b2eb7e 100644 --- a/Program.cs +++ b/Program.cs @@ -99,6 +99,7 @@ namespace GHelper } + Application.EnableVisualStyles(); trayIcon.MouseClick += TrayIcon_MouseClick; ; diff --git a/Settings.cs b/Settings.cs index a9acd958..3dac452a 100644 --- a/Settings.cs +++ b/Settings.cs @@ -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); }); diff --git a/app.manifest b/app.manifest index 1c128261..fd7c117d 100644 --- a/app.manifest +++ b/app.manifest @@ -54,6 +54,7 @@ + true PerMonitorV2, PerMonitor, System