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.
authormoel.mich
Tue, 02 Mar 2010 22:52:37 +0000
changeset 70dc69dc4d7512
parent 69 5f539c00e925
child 71 9b08df4bf2f2
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.
GUI/MainForm.cs
GUI/SensorNotifyIcon.cs
Properties/AssemblyInfo.cs
     1.1 --- a/GUI/MainForm.cs	Tue Mar 02 22:26:07 2010 +0000
     1.2 +++ b/GUI/MainForm.cs	Tue Mar 02 22:52:37 2010 +0000
     1.3 @@ -157,6 +157,9 @@
     1.4        } else {
     1.5          Show();
     1.6        }
     1.7 +
     1.8 +      // Create a handle, otherwise calling Close() does not fire FormClosed
     1.9 +      CreateHandle();
    1.10      }
    1.11  
    1.12      private void SubHardwareAdded(IHardware hardware, Node node) {
    1.13 @@ -233,7 +236,7 @@
    1.14      }
    1.15  
    1.16      private void exitToolStripMenuItem_Click(object sender, EventArgs e) {
    1.17 -      Close();
    1.18 +      Close();      
    1.19      }
    1.20  
    1.21      private void timer_Tick(object sender, EventArgs e) {
     2.1 --- a/GUI/SensorNotifyIcon.cs	Tue Mar 02 22:26:07 2010 +0000
     2.2 +++ b/GUI/SensorNotifyIcon.cs	Tue Mar 02 22:52:37 2010 +0000
     2.3 @@ -59,6 +59,7 @@
     2.4      private Brush brush;
     2.5      private Brush darkBrush;
     2.6      private Pen pen;
     2.7 +    private Font font;
     2.8  
     2.9      public SensorNotifyIcon(SensorSystemTray sensorSystemTray, ISensor sensor,
    2.10        bool balloonTip) 
    2.11 @@ -73,6 +74,7 @@
    2.12        Color = Config.Get(sensor.Identifier + "/traycolor", defaultColor);      
    2.13        
    2.14        this.pen = new Pen(Color.FromArgb(96, Color.Black));
    2.15 +      this.font = new Font(SystemFonts.StatusFont.FontFamily, 9);
    2.16  
    2.17        ContextMenuStrip contextMenuStrip = new ContextMenuStrip();
    2.18        ToolStripMenuItem removeItem = new ToolStripMenuItem("Remove");
    2.19 @@ -134,6 +136,7 @@
    2.20        if (darkBrush != null)
    2.21          darkBrush.Dispose();
    2.22        pen.Dispose();
    2.23 +      font.Dispose();
    2.24        graphics.Dispose();
    2.25        graphics = null;
    2.26        bitmap.Dispose();
    2.27 @@ -161,7 +164,7 @@
    2.28      private Icon CreateTransparentIcon() {
    2.29  
    2.30        graphics.Clear(Color.Black);
    2.31 -      TextRenderer.DrawText(graphics, GetString(), SystemFonts.StatusFont,
    2.32 +      TextRenderer.DrawText(graphics, GetString(), font,
    2.33          new Point(-2, 0), Color.White, Color.Black);
    2.34  
    2.35        BitmapData data = bitmap.LockBits(
     3.1 --- a/Properties/AssemblyInfo.cs	Tue Mar 02 22:26:07 2010 +0000
     3.2 +++ b/Properties/AssemblyInfo.cs	Tue Mar 02 22:52:37 2010 +0000
     3.3 @@ -69,5 +69,5 @@
     3.4  // You can specify all the values or you can default the Build and Revision Numbers 
     3.5  // by using the '*' as shown below:
     3.6  // [assembly: AssemblyVersion("1.0.*")]
     3.7 -[assembly: AssemblyVersion("0.1.24.3")]
     3.8 -[assembly: AssemblyFileVersion("0.1.24.3")]
     3.9 +[assembly: AssemblyVersion("0.1.25.0")]
    3.10 +[assembly: AssemblyFileVersion("0.1.25.0")]