From 1cd9c30c4ab333359540f6893d384fee2ef69feb Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Mon, 12 Jun 2023 14:41:47 +0200 Subject: [PATCH] UI Tweaks --- app/Fans.Designer.cs | 53 ++++++++++------------------ app/Fans.cs | 2 +- app/Fans.resx | 40 --------------------- app/GHelper.csproj | 2 +- app/Program.cs | 4 +++ app/Properties/Resources.Designer.cs | 40 +++++++++++++++++++++ app/Properties/Resources.resx | 12 +++++++ app/Settings.cs | 37 ++++++++----------- app/ToastForm.cs | 13 ++++--- 9 files changed, 98 insertions(+), 105 deletions(-) diff --git a/app/Fans.Designer.cs b/app/Fans.Designer.cs index 853f0f47..9536d650 100644 --- a/app/Fans.Designer.cs +++ b/app/Fans.Designer.cs @@ -39,7 +39,6 @@ namespace GHelper Title title3 = new Title(); ChartArea chartArea4 = new ChartArea(); Title title4 = new Title(); - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Fans)); panelFans = new Panel(); labelTip = new Label(); tableFanCharts = new TableLayoutPanel(); @@ -266,7 +265,7 @@ namespace GHelper buttonRename.BorderColor = Color.Transparent; buttonRename.BorderRadius = 2; buttonRename.FlatStyle = FlatStyle.Flat; - buttonRename.Image = (Image)resources.GetObject("buttonRename.Image"); + buttonRename.Image = Properties.Resources.icons8_edit_32; buttonRename.Location = new Point(374, 12); buttonRename.Margin = new Padding(4, 2, 4, 2); buttonRename.Name = "buttonRename"; @@ -283,7 +282,7 @@ namespace GHelper buttonRemove.BorderColor = Color.Transparent; buttonRemove.BorderRadius = 2; buttonRemove.FlatStyle = FlatStyle.Flat; - buttonRemove.Image = (Image)resources.GetObject("buttonRemove.Image"); + buttonRemove.Image = Properties.Resources.icons8_remove_64; buttonRemove.Location = new Point(319, 12); buttonRemove.Margin = new Padding(4, 2, 4, 2); buttonRemove.Name = "buttonRemove"; @@ -300,7 +299,7 @@ namespace GHelper buttonAdd.BorderColor = Color.Transparent; buttonAdd.BorderRadius = 2; buttonAdd.FlatStyle = FlatStyle.Flat; - buttonAdd.Image = (Image)resources.GetObject("buttonAdd.Image"); + buttonAdd.Image = Properties.Resources.icons8_add_64; buttonAdd.Location = new Point(742, 12); buttonAdd.Margin = new Padding(4, 2, 4, 2); buttonAdd.Name = "buttonAdd"; @@ -500,12 +499,11 @@ namespace GHelper // // labelB0 // - labelB0.Anchor = AnchorStyles.Top | AnchorStyles.Right; labelB0.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); labelB0.Location = new Point(398, 8); labelB0.Margin = new Padding(4, 0, 4, 0); labelB0.Name = "labelB0"; - labelB0.Size = new Size(120, 32); + labelB0.Size = new Size(115, 32); labelB0.TabIndex = 13; labelB0.Text = "CPU"; labelB0.TextAlign = ContentAlignment.TopRight; @@ -522,13 +520,12 @@ namespace GHelper // // trackB0 // - trackB0.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; trackB0.Location = new Point(6, 44); trackB0.Margin = new Padding(4, 2, 4, 2); trackB0.Maximum = 85; trackB0.Minimum = 5; trackB0.Name = "trackB0"; - trackB0.Size = new Size(513, 90); + trackB0.Size = new Size(508, 90); trackB0.TabIndex = 11; trackB0.TickFrequency = 5; trackB0.TickStyle = TickStyle.TopLeft; @@ -551,12 +548,11 @@ namespace GHelper // // labelC1 // - labelC1.Anchor = AnchorStyles.Top | AnchorStyles.Right; labelC1.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); labelC1.Location = new Point(396, 8); labelC1.Margin = new Padding(4, 0, 4, 0); labelC1.Name = "labelC1"; - labelC1.Size = new Size(119, 32); + labelC1.Size = new Size(114, 32); labelC1.TabIndex = 13; labelC1.Text = "C1"; labelC1.TextAlign = ContentAlignment.TopRight; @@ -573,13 +569,12 @@ namespace GHelper // // trackC1 // - trackC1.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; trackC1.Location = new Point(6, 48); trackC1.Margin = new Padding(4, 2, 4, 2); trackC1.Maximum = 85; trackC1.Minimum = 5; trackC1.Name = "trackC1"; - trackC1.Size = new Size(513, 90); + trackC1.Size = new Size(508, 90); trackC1.TabIndex = 11; trackC1.TickFrequency = 5; trackC1.TickStyle = TickStyle.TopLeft; @@ -602,12 +597,11 @@ namespace GHelper // // labelA0 // - labelA0.Anchor = AnchorStyles.Top | AnchorStyles.Right; labelA0.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); labelA0.Location = new Point(396, 10); labelA0.Margin = new Padding(4, 0, 4, 0); labelA0.Name = "labelA0"; - labelA0.Size = new Size(122, 32); + labelA0.Size = new Size(117, 32); labelA0.TabIndex = 12; labelA0.Text = "Platform"; labelA0.TextAlign = ContentAlignment.TopRight; @@ -624,13 +618,12 @@ namespace GHelper // // trackA0 // - trackA0.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; trackA0.Location = new Point(6, 48); trackA0.Margin = new Padding(4, 2, 4, 2); trackA0.Maximum = 180; trackA0.Minimum = 10; trackA0.Name = "trackA0"; - trackA0.Size = new Size(513, 90); + trackA0.Size = new Size(508, 90); trackA0.TabIndex = 10; trackA0.TickFrequency = 5; trackA0.TickStyle = TickStyle.TopLeft; @@ -712,11 +705,10 @@ namespace GHelper // // labelGPUTemp // - labelGPUTemp.Anchor = AnchorStyles.Top | AnchorStyles.Right; labelGPUTemp.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); labelGPUTemp.Location = new Point(378, 14); labelGPUTemp.Name = "labelGPUTemp"; - labelGPUTemp.Size = new Size(130, 32); + labelGPUTemp.Size = new Size(125, 32); labelGPUTemp.TabIndex = 44; labelGPUTemp.Text = "87C"; labelGPUTemp.TextAlign = ContentAlignment.TopRight; @@ -732,13 +724,12 @@ namespace GHelper // // trackGPUTemp // - trackGPUTemp.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; trackGPUTemp.Location = new Point(6, 57); trackGPUTemp.Margin = new Padding(4, 2, 4, 2); trackGPUTemp.Maximum = 87; trackGPUTemp.Minimum = 75; trackGPUTemp.Name = "trackGPUTemp"; - trackGPUTemp.Size = new Size(502, 90); + trackGPUTemp.Size = new Size(497, 90); trackGPUTemp.TabIndex = 42; trackGPUTemp.TickFrequency = 5; trackGPUTemp.TickStyle = TickStyle.TopLeft; @@ -760,11 +751,10 @@ namespace GHelper // // labelGPUBoost // - labelGPUBoost.Anchor = AnchorStyles.Top | AnchorStyles.Right; labelGPUBoost.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); labelGPUBoost.Location = new Point(374, 14); labelGPUBoost.Name = "labelGPUBoost"; - labelGPUBoost.Size = new Size(130, 32); + labelGPUBoost.Size = new Size(125, 32); labelGPUBoost.TabIndex = 44; labelGPUBoost.Text = "25W"; labelGPUBoost.TextAlign = ContentAlignment.TopRight; @@ -780,13 +770,12 @@ namespace GHelper // // trackGPUBoost // - trackGPUBoost.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; trackGPUBoost.Location = new Point(6, 48); trackGPUBoost.Margin = new Padding(4, 2, 4, 2); trackGPUBoost.Maximum = 25; trackGPUBoost.Minimum = 5; trackGPUBoost.Name = "trackGPUBoost"; - trackGPUBoost.Size = new Size(502, 90); + trackGPUBoost.Size = new Size(497, 90); trackGPUBoost.TabIndex = 42; trackGPUBoost.TickFrequency = 5; trackGPUBoost.TickStyle = TickStyle.TopLeft; @@ -808,11 +797,10 @@ namespace GHelper // // labelGPUMemory // - labelGPUMemory.Anchor = AnchorStyles.Top | AnchorStyles.Right; labelGPUMemory.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); - labelGPUMemory.Location = new Point(378, 14); + labelGPUMemory.Location = new Point(344, 14); labelGPUMemory.Name = "labelGPUMemory"; - labelGPUMemory.Size = new Size(130, 32); + labelGPUMemory.Size = new Size(159, 32); labelGPUMemory.TabIndex = 44; labelGPUMemory.Text = "2000 MHz"; labelGPUMemory.TextAlign = ContentAlignment.TopRight; @@ -828,13 +816,12 @@ namespace GHelper // // trackGPUMemory // - trackGPUMemory.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; trackGPUMemory.LargeChange = 100; trackGPUMemory.Location = new Point(6, 48); trackGPUMemory.Margin = new Padding(4, 2, 4, 2); trackGPUMemory.Maximum = 300; trackGPUMemory.Name = "trackGPUMemory"; - trackGPUMemory.Size = new Size(502, 90); + trackGPUMemory.Size = new Size(497, 90); trackGPUMemory.SmallChange = 10; trackGPUMemory.TabIndex = 42; trackGPUMemory.TickFrequency = 50; @@ -856,25 +843,23 @@ namespace GHelper // // labelGPUCore // - labelGPUCore.Anchor = AnchorStyles.Top | AnchorStyles.Right; labelGPUCore.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); - labelGPUCore.Location = new Point(378, 15); + labelGPUCore.Location = new Point(326, 15); labelGPUCore.Name = "labelGPUCore"; - labelGPUCore.Size = new Size(130, 32); + labelGPUCore.Size = new Size(177, 32); labelGPUCore.TabIndex = 29; labelGPUCore.Text = "1500 MHz"; labelGPUCore.TextAlign = ContentAlignment.TopRight; // // trackGPUCore // - trackGPUCore.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; trackGPUCore.LargeChange = 100; trackGPUCore.Location = new Point(6, 47); trackGPUCore.Margin = new Padding(4, 2, 4, 2); trackGPUCore.Maximum = 300; trackGPUCore.Name = "trackGPUCore"; trackGPUCore.RightToLeft = RightToLeft.No; - trackGPUCore.Size = new Size(502, 90); + trackGPUCore.Size = new Size(497, 90); trackGPUCore.SmallChange = 10; trackGPUCore.TabIndex = 18; trackGPUCore.TickFrequency = 50; diff --git a/app/Fans.cs b/app/Fans.cs index 1c1cdb1d..ad667bf5 100644 --- a/app/Fans.cs +++ b/app/Fans.cs @@ -48,7 +48,7 @@ namespace GHelper labelGPUBoostTitle.Text = Properties.Strings.GPUBoost; labelGPUTempTitle.Text = Properties.Strings.GPUTempTarget; - InitTheme(); + InitTheme(true); MinRPM = 18; MaxRPM = HardwareControl.GetFanMax(); diff --git a/app/Fans.resx b/app/Fans.resx index cb7b6477..a395bffc 100644 --- a/app/Fans.resx +++ b/app/Fans.resx @@ -117,44 +117,4 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAL - DAAACwwBP0AiyAAAAR9JREFUWEftlEuKwkAURTPQHruB3oMINk5chNtRHAnuwFX0R3vQq2lw6kRxCXqP - 5EE6dPKqNOWoDhw0lUrdS6VIkckkpCeXcl/Kf8aeQl++y0vNhUwO4R+SwJN8k9Py+lcmpR4+kjCRwQWY - GCNbzbsl/LMcq4bzyzXjcwY8qot7VsO/yrGmcJvrYouHUg0/y7GEoTxKxtkZ5gURU4BFt7KzcAgt8CI7 - D4eQAsnCwStA+LdkTtOB40wQfteXzyswk23h7IyFc/Kj8QqsJPfXt6u/4TvJDoF9iqPxCvxI7m8kJSyc - 12Lh4K3TiPfgQdocsx4Odi+atgdfJfcowU7wOjgT9XBIUmAgKRFCkgIx5AK5wMMFujKa/xZ5xEymhaK4 - AsqsxiD2d6spAAAAAElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAL - DAAACwwBP0AiyAAAAclJREFUWEftls0uBEEQx+fkI1zWjeAusTyBeAC8EC68Ahu8DImvp8ANF44EB/x/ - na3LRM9099YSyf6TXzJdU13T011d3dVI/02rYl+ciQfx0YdnbLzDx13r4lJ8JXIh6DOwJsWJ+BQEfhIH - YkMsiLE+PGM7FPjgSx/6EqNIM+JaEOxFbIsp0SZ8dsSroC8xOiJLjNo+fiOWRa6WxK2wQWTNBFNnH5/F - UCj62iCOMKSI5GH9mPaSP6+LGCwHMdcwtMmynTX3ErGIeR5aDVoROJLJKQmXKmLZ7uAbUVFIcGKreasn - iL0XWhFRzXBiT3trUxD7NLQiehQ4zYeWrxYFsSnbUb0LnKhudWHPoa5xgf0ttCL68wHYElDbvWVLcB9a - EQ0zCbcEsRuT0LYhp5q3krbhsArRtHgWxG4sRIjLBI4cqV7aFcRsLcXIDiMOkC6GAZV9GKFjwYg5Sucw - FIq+d4JYyccx4vJwJWwQJRdNZs8+zoVkQmSJa5QNgikkJ0imNuHDmtuVjBjZVzITM8HUsX4EI5PZThws - FBa7lPLMPuedZTt96Jv95z+J5CGDCZwCvskJlyP2MIWEakZJ5ewAnrHxzmPnjPRbqqpvzOytki4+4b0A - AAAASUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAL - DAAACwwBP0AiyAAAAddJREFUWEftlssuBUEQhmflEjbsCPYSlycQD4AXwoZXQPAyJG5PgR02LAkW+L/O - qc3J6emqOXOI5PzJl0z3VNfUdFdXdzXUf9Oq2Bfn4lF8duCZPt5h07rWxZX4dnIpGNO3xsWp+BI4fhYH - YkPMi5EOPNN3KLDBljGMxUcjTYsbgbNXsS0mREnY7Ig3wVh8TImQiNo+fiuWRFSL4k5YEKGZYOrs4zN0 - NBRjLYhjOjwieVg/pr3Jn3cLHywHPtfoKMmynTVvS/jC50Vq1WhFYEgmexIOWygJX7Y7+EZWFBKM2Goe - eQNARwLbvdTKiGqGEXvao0gAmwLbs9TK6ElgNJdaZUUCWBDYUraz+hAYUd16yT5YopdGBe/eUyujPw/A - loDa7lHdB7tlS/CQWhkNMgm3BLa1SWjbkFPNo0gArm04qEI0KV4EtrWFCHGZwJAjtS3tCnwWSzGyw4gD - ZJmOPhU+jNCJIGKO0lk6Goqx9wJf7uMYcXm4FhZEk4sms2cf50IyJkLiGmVBMIXkBMlUEjasuV3J8BG+ - kpmYCaaO9cMZmcx24mChsNillGf2Oe8s2xnD2PCf9xLJQwbj2AO27oSLiD1MIaGaUVI5O4Bn+njXxs4Z - 6rdUVT8f7bmGe+JHiAAAAABJRU5ErkJggg== - - \ No newline at end of file diff --git a/app/GHelper.csproj b/app/GHelper.csproj index c66db409..260539ec 100644 --- a/app/GHelper.csproj +++ b/app/GHelper.csproj @@ -16,7 +16,7 @@ AnyCPU False True - 0.83 + 0.84 diff --git a/app/Program.cs b/app/Program.cs index 8981428c..cf7326a3 100644 --- a/app/Program.cs +++ b/app/Program.cs @@ -177,6 +177,10 @@ namespace GHelper if (settingsForm.Visible) settingsForm.HideAll(); else { + + settingsForm.Left = Screen.FromControl(settingsForm).WorkingArea.Width - 10 - settingsForm.Width; + settingsForm.Top = Screen.FromControl(settingsForm).WorkingArea.Height - 10 - settingsForm.Height; + settingsForm.Show(); settingsForm.Activate(); settingsForm.VisualiseGPUMode(); diff --git a/app/Properties/Resources.Designer.cs b/app/Properties/Resources.Designer.cs index a79bbfeb..83f34072 100644 --- a/app/Properties/Resources.Designer.cs +++ b/app/Properties/Resources.Designer.cs @@ -110,6 +110,16 @@ namespace GHelper.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap icons8_add_64 { + get { + object obj = ResourceManager.GetObject("icons8_add_64", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// @@ -160,6 +170,16 @@ namespace GHelper.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap icons8_edit_32 { + get { + object obj = ResourceManager.GetObject("icons8_edit_32", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// @@ -360,6 +380,16 @@ namespace GHelper.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap icons8_remove_64 { + get { + object obj = ResourceManager.GetObject("icons8_remove_64", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// @@ -370,6 +400,16 @@ namespace GHelper.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap icons8_share_32 { + get { + object obj = ResourceManager.GetObject("icons8_share_32", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/app/Properties/Resources.resx b/app/Properties/Resources.resx index 28ea640e..aa3382de 100644 --- a/app/Properties/Resources.resx +++ b/app/Properties/Resources.resx @@ -244,4 +244,16 @@ ..\Resources\icons8-charging-battery-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\icons8-add-64.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icons8-edit-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icons8-remove-64.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icons8-share-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/app/Settings.cs b/app/Settings.cs index 2b34cc34..9a634970 100644 --- a/app/Settings.cs +++ b/app/Settings.cs @@ -189,6 +189,16 @@ namespace GHelper } + private void SettingsForm_VisibleChanged(object? sender, EventArgs e) + { + aTimer.Enabled = this.Visible; + if (this.Visible) + { + InitScreen(); + InitXGM(); + } + } + private void ButtonUpdates_Click(object? sender, EventArgs e) { if (updates == null || updates.Text == "") @@ -876,6 +886,8 @@ namespace GHelper bool screenEnabled = (frequency >= 0); + Debug.WriteLine(frequency.ToString()); + ButtonEnabled(button60Hz, screenEnabled); ButtonEnabled(button120Hz, screenEnabled); ButtonEnabled(buttonScreenAuto, screenEnabled); @@ -1012,27 +1024,6 @@ namespace GHelper } - private void SettingsForm_VisibleChanged(object? sender, EventArgs e) - { - if (this.Visible) - { - InitScreen(); - InitXGM(); - - this.Left = Screen.FromControl(this).WorkingArea.Width - 10 - this.Width; - this.Top = Screen.FromControl(this).WorkingArea.Height - 10 - this.Height; - this.Activate(); - - aTimer.Enabled = true; - - } - else - { - aTimer.Enabled = false; - } - } - - private void SetPerformanceLabel() { labelPerf.Text = Properties.Strings.PerformanceMode + ": " + Modes.GetCurrentName() + (customFans ? "+" : "") + ((customPower > 0) ? " " + customPower + "W" : ""); @@ -1497,8 +1488,10 @@ namespace GHelper public void InitXGM() { + bool connected = Program.acpi.IsXGConnected(); + buttonXGM.Enabled = buttonXGM.Visible = connected; - buttonXGM.Enabled = buttonXGM.Visible = Program.acpi.IsXGConnected(); + if (!connected) return; int activated = Program.acpi.DeviceGet(AsusACPI.GPUXG); if (activated < 0) return; diff --git a/app/ToastForm.cs b/app/ToastForm.cs index b0f1599f..0b2c97ae 100644 --- a/app/ToastForm.cs +++ b/app/ToastForm.cs @@ -1,7 +1,6 @@ -using System.Diagnostics; -using System.Drawing; +using OSD; +using System.Diagnostics; using System.Drawing.Drawing2D; -using OSD; namespace GHelper @@ -57,7 +56,7 @@ namespace GHelper Charger } - public class ToastForm : OSDNativeForm + public class ToastForm : OSDNativeForm { protected static string toastText = "Balanced"; @@ -74,7 +73,7 @@ namespace GHelper protected override void PerformPaint(PaintEventArgs e) { - Brush brush = new SolidBrush(Color.FromArgb(150,Color.Black)); + Brush brush = new SolidBrush(Color.FromArgb(150, Color.Black)); Drawing.FillRoundedRectangle(e.Graphics, brush, this.Bound, 10); StringFormat format = new StringFormat(); @@ -144,9 +143,9 @@ namespace GHelper Screen screen1 = Screen.FromHandle(base.Handle); - Width = Math.Max(300, 100 + toastText.Length*22); + Width = Math.Max(300, 100 + toastText.Length * 22); Height = 100; - X = (screen1.Bounds.Width - this.Width)/2; + X = (screen1.Bounds.Width - this.Width) / 2; Y = screen1.Bounds.Height - 300 - this.Height; Show();