mirror of
https://github.com/openhardwaremonitor/openhardwaremonitor
synced 2025-08-29 05:18:14 +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:
parent
207860b427
commit
b4918b3cc3
@ -157,6 +157,9 @@ namespace OpenHardwareMonitor.GUI {
|
||||
} else {
|
||||
Show();
|
||||
}
|
||||
|
||||
// Create a handle, otherwise calling Close() does not fire FormClosed
|
||||
CreateHandle();
|
||||
}
|
||||
|
||||
private void SubHardwareAdded(IHardware hardware, Node node) {
|
||||
@ -233,7 +236,7 @@ namespace OpenHardwareMonitor.GUI {
|
||||
}
|
||||
|
||||
private void exitToolStripMenuItem_Click(object sender, EventArgs e) {
|
||||
Close();
|
||||
Close();
|
||||
}
|
||||
|
||||
private void timer_Tick(object sender, EventArgs e) {
|
||||
|
@ -59,6 +59,7 @@ namespace OpenHardwareMonitor.GUI {
|
||||
private Brush brush;
|
||||
private Brush darkBrush;
|
||||
private Pen pen;
|
||||
private Font font;
|
||||
|
||||
public SensorNotifyIcon(SensorSystemTray sensorSystemTray, ISensor sensor,
|
||||
bool balloonTip)
|
||||
@ -73,6 +74,7 @@ namespace OpenHardwareMonitor.GUI {
|
||||
Color = Config.Get(sensor.Identifier + "/traycolor", defaultColor);
|
||||
|
||||
this.pen = new Pen(Color.FromArgb(96, Color.Black));
|
||||
this.font = new Font(SystemFonts.StatusFont.FontFamily, 9);
|
||||
|
||||
ContextMenuStrip contextMenuStrip = new ContextMenuStrip();
|
||||
ToolStripMenuItem removeItem = new ToolStripMenuItem("Remove");
|
||||
@ -134,6 +136,7 @@ namespace OpenHardwareMonitor.GUI {
|
||||
if (darkBrush != null)
|
||||
darkBrush.Dispose();
|
||||
pen.Dispose();
|
||||
font.Dispose();
|
||||
graphics.Dispose();
|
||||
graphics = null;
|
||||
bitmap.Dispose();
|
||||
@ -161,7 +164,7 @@ namespace OpenHardwareMonitor.GUI {
|
||||
private Icon CreateTransparentIcon() {
|
||||
|
||||
graphics.Clear(Color.Black);
|
||||
TextRenderer.DrawText(graphics, GetString(), SystemFonts.StatusFont,
|
||||
TextRenderer.DrawText(graphics, GetString(), font,
|
||||
new Point(-2, 0), Color.White, Color.Black);
|
||||
|
||||
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
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("0.1.24.3")]
|
||||
[assembly: AssemblyFileVersion("0.1.24.3")]
|
||||
[assembly: AssemblyVersion("0.1.25.0")]
|
||||
[assembly: AssemblyFileVersion("0.1.25.0")]
|
||||
|
Loading…
x
Reference in New Issue
Block a user