1.1 --- a/GUI/SensorNotifyIcon.cs Tue Jul 17 16:12:07 2012 +0000
1.2 +++ b/GUI/SensorNotifyIcon.cs Wed Jul 18 19:45:59 2012 +0000
1.3 @@ -53,8 +53,6 @@
1.4 "traycolor").ToString(), defaultColor);
1.5
1.6 this.pen = new Pen(Color.FromArgb(96, Color.Black));
1.7 - this.font = SystemFonts.MessageBoxFont;
1.8 - this.smallFont = new Font(font.FontFamily, font.Size * 0.8f);
1.9
1.10 ContextMenu contextMenu = new ContextMenu();
1.11 MenuItem hideShowItem = new MenuItem("Hide/Show");
1.12 @@ -88,7 +86,7 @@
1.13 this.notifyIcon.ContextMenu = contextMenu;
1.14 this.notifyIcon.DoubleClick += delegate(object obj, EventArgs args) {
1.15 sensorSystemTray.SendHideShowCommand();
1.16 - };
1.17 + };
1.18
1.19 // get the default dpi to create an icon with the correct size
1.20 float dpiX, dpiY;
1.21 @@ -102,8 +100,22 @@
1.22 int height = (int)Math.Round(16 * dpiY / 96);
1.23
1.24 // make sure it does never get smaller than 16x16
1.25 - width = width < 16 ? 16: width;
1.26 - height = height < 16 ? 16: height;
1.27 + width = width < 16 ? 16 : width;
1.28 + height = height < 16 ? 16 : height;
1.29 +
1.30 + // adjust the font size to the icon size
1.31 + FontFamily family = SystemFonts.MessageBoxFont.FontFamily;
1.32 + float baseSize;
1.33 + switch (family.Name) {
1.34 + case "Segoe UI": baseSize = 12; break;
1.35 + case "Tahoma": baseSize = 11; break;
1.36 + default: baseSize = 12; break;
1.37 + }
1.38 +
1.39 + this.font = new Font(family,
1.40 + baseSize * width / 16.0f, GraphicsUnit.Pixel);
1.41 + this.smallFont = new Font(family,
1.42 + 0.75f * baseSize * width / 16.0f, GraphicsUnit.Pixel);
1.43
1.44 this.bitmap = new Bitmap(width, height, PixelFormat.Format32bppArgb);
1.45 this.graphics = Graphics.FromImage(this.bitmap);
1.46 @@ -151,6 +163,7 @@
1.47 pen.Dispose();
1.48 graphics.Dispose();
1.49 bitmap.Dispose();
1.50 + font.Dispose();
1.51 smallFont.Dispose();
1.52 }
1.53
1.54 @@ -169,7 +182,7 @@
1.55 if (unitManager.TemperatureUnit == TemperatureUnit.Fahrenheit)
1.56 return string.Format("{0:F0}",
1.57 UnitManager.CelsiusToFahrenheit(sensor.Value));
1.58 - else
1.59 + else
1.60 return string.Format("{0:F0}", sensor.Value);
1.61 case SensorType.Fan:
1.62 return string.Format("{0:F1}", 1e-3f * sensor.Value);