Icons cleanup

This commit is contained in:
Serge
2023-11-21 13:07:03 +01:00
parent 45e7e5551e
commit 267cf6387f
10 changed files with 39 additions and 40 deletions

View File

@@ -1150,13 +1150,6 @@ namespace GHelper
});
}
[DllImport("user32.dll", CharSet = CharSet.Auto)]
private static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
private const uint WM_SETICON = 0x80u;
private const int ICON_SMALL = 0;
private const int ICON_BIG = 1;
public void VisualiseGPUMode(int GPUMode = -1)
{
ButtonEnabled(buttonOptimized, true);
@@ -1164,9 +1157,6 @@ namespace GHelper
ButtonEnabled(buttonStandard, true);
ButtonEnabled(buttonUltimate, true);
Bitmap? smallBmp = null;
Bitmap? bigBmp = null;
if (GPUMode == -1)
GPUMode = AppConfig.Get("gpu_mode");
@@ -1185,23 +1175,13 @@ namespace GHelper
buttonOptimized.Activated = GPUAuto;
labelGPU.Text = Properties.Strings.GPUMode + ": " + Properties.Strings.GPUModeEco;
Program.trayIcon.Icon = Properties.Resources.eco;
smallBmp = Properties.Resources.dot_eco.ToBitmap();
bigBmp = Properties.Resources.eco.ToBitmap();
SendMessage(this.Handle, WM_SETICON, ICON_SMALL, smallBmp.GetHicon());
SendMessage(this.Handle, WM_SETICON, ICON_BIG, bigBmp.GetHicon());
IconHelper.SetIcon(this, Properties.Resources.dot_eco);
break;
case AsusACPI.GPUModeUltimate:
buttonUltimate.Activated = true;
labelGPU.Text = Properties.Strings.GPUMode + ": " + Properties.Strings.GPUModeUltimate;
Program.trayIcon.Icon = Properties.Resources.ultimate;
smallBmp = Properties.Resources.dot_ultimate.ToBitmap();
bigBmp = Properties.Resources.ultimate.ToBitmap();
SendMessage(this.Handle, WM_SETICON, ICON_SMALL, smallBmp.GetHicon());
SendMessage(this.Handle, WM_SETICON, ICON_BIG, bigBmp.GetHicon());
IconHelper.SetIcon(this, Properties.Resources.dot_ultimate);
break;
default:
buttonOptimized.BorderColor = colorStandard;
@@ -1209,12 +1189,7 @@ namespace GHelper
buttonOptimized.Activated = GPUAuto;
labelGPU.Text = Properties.Strings.GPUMode + ": " + Properties.Strings.GPUModeStandard;
Program.trayIcon.Icon = Properties.Resources.standard;
smallBmp = Properties.Resources.dot_standard.ToBitmap();
bigBmp = Properties.Resources.standard.ToBitmap();
SendMessage(this.Handle, WM_SETICON, ICON_SMALL, smallBmp.GetHicon());
SendMessage(this.Handle, WM_SETICON, ICON_BIG, bigBmp.GetHicon());
IconHelper.SetIcon(this, Properties.Resources.dot_standard);
break;
}