mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
setting different icon for taskbar and title bar (#1614)
* setting different icon for taskbar and title bar * fixing variables
This commit is contained in:
committed by
GitHub
parent
bb796b8818
commit
45e7e5551e
2
app/Settings.Designer.cs
generated
2
app/Settings.Designer.cs
generated
@@ -1439,7 +1439,7 @@ namespace GHelper
|
|||||||
MinimumSize = new Size(822, 71);
|
MinimumSize = new Size(822, 71);
|
||||||
Name = "SettingsForm";
|
Name = "SettingsForm";
|
||||||
Padding = new Padding(11);
|
Padding = new Padding(11);
|
||||||
ShowIcon = false;
|
ShowIcon = true;
|
||||||
StartPosition = FormStartPosition.CenterScreen;
|
StartPosition = FormStartPosition.CenterScreen;
|
||||||
Text = "G-Helper";
|
Text = "G-Helper";
|
||||||
panelMatrix.ResumeLayout(false);
|
panelMatrix.ResumeLayout(false);
|
||||||
|
|||||||
@@ -13,13 +13,12 @@ using GHelper.UI;
|
|||||||
using GHelper.USB;
|
using GHelper.USB;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Timers;
|
using System.Timers;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace GHelper
|
namespace GHelper
|
||||||
{
|
{
|
||||||
|
|
||||||
public partial class SettingsForm : RForm
|
public partial class SettingsForm : RForm
|
||||||
{
|
{
|
||||||
|
|
||||||
ContextMenuStrip contextMenuStrip = new CustomContextMenu();
|
ContextMenuStrip contextMenuStrip = new CustomContextMenu();
|
||||||
ToolStripMenuItem menuSilent, menuBalanced, menuTurbo, menuEco, menuStandard, menuUltimate, menuOptimized;
|
ToolStripMenuItem menuSilent, menuBalanced, menuTurbo, menuEco, menuStandard, menuUltimate, menuOptimized;
|
||||||
|
|
||||||
@@ -1151,6 +1150,12 @@ 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)
|
public void VisualiseGPUMode(int GPUMode = -1)
|
||||||
{
|
{
|
||||||
@@ -1159,6 +1164,9 @@ namespace GHelper
|
|||||||
ButtonEnabled(buttonStandard, true);
|
ButtonEnabled(buttonStandard, true);
|
||||||
ButtonEnabled(buttonUltimate, true);
|
ButtonEnabled(buttonUltimate, true);
|
||||||
|
|
||||||
|
Bitmap? smallBmp = null;
|
||||||
|
Bitmap? bigBmp = null;
|
||||||
|
|
||||||
if (GPUMode == -1)
|
if (GPUMode == -1)
|
||||||
GPUMode = AppConfig.Get("gpu_mode");
|
GPUMode = AppConfig.Get("gpu_mode");
|
||||||
|
|
||||||
@@ -1177,13 +1185,23 @@ namespace GHelper
|
|||||||
buttonOptimized.Activated = GPUAuto;
|
buttonOptimized.Activated = GPUAuto;
|
||||||
labelGPU.Text = Properties.Strings.GPUMode + ": " + Properties.Strings.GPUModeEco;
|
labelGPU.Text = Properties.Strings.GPUMode + ": " + Properties.Strings.GPUModeEco;
|
||||||
Program.trayIcon.Icon = Properties.Resources.eco;
|
Program.trayIcon.Icon = Properties.Resources.eco;
|
||||||
Icon = Properties.Resources.dot_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());
|
||||||
break;
|
break;
|
||||||
case AsusACPI.GPUModeUltimate:
|
case AsusACPI.GPUModeUltimate:
|
||||||
buttonUltimate.Activated = true;
|
buttonUltimate.Activated = true;
|
||||||
labelGPU.Text = Properties.Strings.GPUMode + ": " + Properties.Strings.GPUModeUltimate;
|
labelGPU.Text = Properties.Strings.GPUMode + ": " + Properties.Strings.GPUModeUltimate;
|
||||||
Program.trayIcon.Icon = Properties.Resources.ultimate;
|
Program.trayIcon.Icon = Properties.Resources.ultimate;
|
||||||
Icon = Properties.Resources.dot_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());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
buttonOptimized.BorderColor = colorStandard;
|
buttonOptimized.BorderColor = colorStandard;
|
||||||
@@ -1191,7 +1209,12 @@ namespace GHelper
|
|||||||
buttonOptimized.Activated = GPUAuto;
|
buttonOptimized.Activated = GPUAuto;
|
||||||
labelGPU.Text = Properties.Strings.GPUMode + ": " + Properties.Strings.GPUModeStandard;
|
labelGPU.Text = Properties.Strings.GPUMode + ": " + Properties.Strings.GPUModeStandard;
|
||||||
Program.trayIcon.Icon = Properties.Resources.standard;
|
Program.trayIcon.Icon = Properties.Resources.standard;
|
||||||
Icon = Properties.Resources.dot_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());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user