mirror of
https://github.com/openhardwaremonitor/openhardwaremonitor
synced 2025-09-02 15:25:22 +00:00
Set the system tray icon font to a fixed size. Fixed the exiting of the application when the form was never shown and Close() is called.
This commit is contained in:
@@ -157,6 +157,9 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
} else {
|
} else {
|
||||||
Show();
|
Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create a handle, otherwise calling Close() does not fire FormClosed
|
||||||
|
CreateHandle();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SubHardwareAdded(IHardware hardware, Node node) {
|
private void SubHardwareAdded(IHardware hardware, Node node) {
|
||||||
|
@@ -59,6 +59,7 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
private Brush brush;
|
private Brush brush;
|
||||||
private Brush darkBrush;
|
private Brush darkBrush;
|
||||||
private Pen pen;
|
private Pen pen;
|
||||||
|
private Font font;
|
||||||
|
|
||||||
public SensorNotifyIcon(SensorSystemTray sensorSystemTray, ISensor sensor,
|
public SensorNotifyIcon(SensorSystemTray sensorSystemTray, ISensor sensor,
|
||||||
bool balloonTip)
|
bool balloonTip)
|
||||||
@@ -73,6 +74,7 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
Color = Config.Get(sensor.Identifier + "/traycolor", defaultColor);
|
Color = Config.Get(sensor.Identifier + "/traycolor", defaultColor);
|
||||||
|
|
||||||
this.pen = new Pen(Color.FromArgb(96, Color.Black));
|
this.pen = new Pen(Color.FromArgb(96, Color.Black));
|
||||||
|
this.font = new Font(SystemFonts.StatusFont.FontFamily, 9);
|
||||||
|
|
||||||
ContextMenuStrip contextMenuStrip = new ContextMenuStrip();
|
ContextMenuStrip contextMenuStrip = new ContextMenuStrip();
|
||||||
ToolStripMenuItem removeItem = new ToolStripMenuItem("Remove");
|
ToolStripMenuItem removeItem = new ToolStripMenuItem("Remove");
|
||||||
@@ -134,6 +136,7 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
if (darkBrush != null)
|
if (darkBrush != null)
|
||||||
darkBrush.Dispose();
|
darkBrush.Dispose();
|
||||||
pen.Dispose();
|
pen.Dispose();
|
||||||
|
font.Dispose();
|
||||||
graphics.Dispose();
|
graphics.Dispose();
|
||||||
graphics = null;
|
graphics = null;
|
||||||
bitmap.Dispose();
|
bitmap.Dispose();
|
||||||
@@ -161,7 +164,7 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
private Icon CreateTransparentIcon() {
|
private Icon CreateTransparentIcon() {
|
||||||
|
|
||||||
graphics.Clear(Color.Black);
|
graphics.Clear(Color.Black);
|
||||||
TextRenderer.DrawText(graphics, GetString(), SystemFonts.StatusFont,
|
TextRenderer.DrawText(graphics, GetString(), font,
|
||||||
new Point(-2, 0), Color.White, Color.Black);
|
new Point(-2, 0), Color.White, Color.Black);
|
||||||
|
|
||||||
BitmapData data = bitmap.LockBits(
|
BitmapData data = bitmap.LockBits(
|
||||||
|
@@ -69,5 +69,5 @@ using System.Runtime.InteropServices;
|
|||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("0.1.24.3")]
|
[assembly: AssemblyVersion("0.1.25.0")]
|
||||||
[assembly: AssemblyFileVersion("0.1.24.3")]
|
[assembly: AssemblyFileVersion("0.1.25.0")]
|
||||||
|
Reference in New Issue
Block a user