# HG changeset patch # User moel.mich # Date 1273923276 0 # Node ID c92e98bc20735a87f77e8ec4f99d5d5bfeabfee5 # Parent 03d3325e85d48c306327af3b9c96bf18eafc83be Fixed the following Exception: System.ArgumentOutOfRangeException: ??? ??? 64? ????? ???. ?? ?? ??: Text ?? ?? ATI Radeon HD 4800 Series (Microsoft Corporation WDDM 1.1) GPU Core: 56.5 ?C???. ??: System.Windows.Forms.NotifyIcon.set_Text(String value) ??: OpenHardwareMonitor.GUI.SensorNotifyIcon.Update() ??: OpenHardwareMonitor.GUI.SensorSystemTray.Redraw() ??: System.Windows.Forms.Timer.OnTick(EventArgs e) ??: System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m) ??: System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) diff -r 03d3325e85d4 -r c92e98bc2073 GUI/SensorNotifyIcon.cs --- a/GUI/SensorNotifyIcon.cs Sat May 15 11:20:50 2010 +0000 +++ b/GUI/SensorNotifyIcon.cs Sat May 15 11:34:36 2010 +0000 @@ -227,16 +227,22 @@ string format = ""; switch (sensor.SensorType) { - case SensorType.Voltage: format = "{0}\n{1}: {2:F2} V"; break; - case SensorType.Clock: format = "{0}\n{1}: {2:F0} MHz"; break; - case SensorType.Load: format = "{0}\n{1}: {2:F1} %"; break; - case SensorType.Temperature: format = "{0}\n{1}: {2:F1} °C"; break; - case SensorType.Fan: format = "{0}\n{1}: {2:F0} RPM"; break; - case SensorType.Flow: format = "{0}\n{1}: {2:F0} L/h"; break; + case SensorType.Voltage: format = "\n{0}: {1:F2} V"; break; + case SensorType.Clock: format = "\n{0}: {1:F0} MHz"; break; + case SensorType.Load: format = "\n{0}: {1:F1} %"; break; + case SensorType.Temperature: format = "\n{0}: {1:F1} °C"; break; + case SensorType.Fan: format = "\n{0}: {1:F0} RPM"; break; + case SensorType.Flow: format = "\n{0}: {1:F0} L/h"; break; } + string formattedValue = string.Format(format, sensor.Name, sensor.Value); + string hardwareName = sensor.Hardware.Name; + hardwareName = hardwareName.Substring(0, + Math.Min(63 - formattedValue.Length, hardwareName.Length)); + string text = hardwareName + formattedValue; + if (text.Length > 63) + text = null; - notifyIcon.Text = string.Format(format, sensor.Hardware.Name, sensor.Name, - sensor.Value); + notifyIcon.Text = text; notifyIcon.Visible = true; } }