Skip to content

Commit 25ebd88

Browse files
committed
CreatePercentageIcon border fix
1 parent ffa9335 commit 25ebd88

2 files changed

Lines changed: 13 additions & 11 deletions

File tree

GUI/SensorNotifyIcon.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public class SensorNotifyIcon : IDisposable {
2121
private Color darkColor;
2222
private Brush brush;
2323
private Brush darkBrush;
24-
private readonly Pen pen;
24+
private Pen pen;
2525
private readonly Font font;
2626
private readonly Font smallFont;
2727

@@ -41,8 +41,6 @@ public SensorNotifyIcon(SystemTray sensorSystemTray, ISensor sensor,
4141

4242
Color = settings.GetValue(new Identifier(sensor.Identifier, "traycolor").ToString(), defaultColor);
4343

44-
pen = new Pen(Color.FromArgb(96, Color.Black));
45-
4644
var contextMenu = new ContextMenu();
4745
var hideShowItem = new MenuItem("Hide/Show");
4846
hideShowItem.DefaultItem = true;
@@ -124,6 +122,10 @@ public Color Color {
124122
brush = new SolidBrush(color);
125123
if (tmpBrush != null)
126124
tmpBrush.Dispose();
125+
var tmpPen = pen;
126+
pen = new Pen(Color.FromArgb(96, color), 1);
127+
if (tmpPen != null)
128+
tmpPen.Dispose();
127129
var tmpDarkBrush = darkBrush;
128130
darkBrush = new SolidBrush(darkColor);
129131
if (tmpDarkBrush != null)
@@ -248,8 +250,8 @@ private Icon CreatePercentageIcon() {
248250
graphics.FillRectangle(darkBrush, 0.5f, -0.5f, bitmap.Width - 2, bitmap.Height);
249251
var value = sensor.Value.GetValueOrDefault();
250252
var y = 0.16f * (100 - value);
251-
graphics.FillRectangle(brush, 0.5f, -0.5f + y, bitmap.Width - 2, bitmap.Height - y);
252-
graphics.DrawRectangle(pen, 1, 0, bitmap.Width - 3, bitmap.Height - 1);
253+
graphics.FillRectangle(brush, 2, 2 + y, bitmap.Width - 5, bitmap.Height - 4 - y);
254+
graphics.DrawRectangle(pen, 1, 1, bitmap.Width - 3, bitmap.Height - 2);
253255

254256
var data = bitmap.LockBits(
255257
new Rectangle(0, 0, bitmap.Width, bitmap.Height),

OpenHardwareMonitor.csproj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0">
3-
<Import Project="c:\temp\nuget\Costura.Fody.4.1.0\build\Costura.Fody.props" Condition="Exists('c:\temp\nuget\Costura.Fody.4.1.0\build\Costura.Fody.props')" />
3+
<Import Project="..\packages\Costura.Fody.4.1.0\build\Costura.Fody.props" Condition="Exists('..\packages\Costura.Fody.4.1.0\build\Costura.Fody.props')" />
44
<PropertyGroup>
55
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
66
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@@ -67,10 +67,10 @@
6767
</PropertyGroup>
6868
<ItemGroup>
6969
<Reference Include="Costura, Version=4.1.0.0, Culture=neutral, PublicKeyToken=9919ef960d84173d, processorArchitecture=MSIL">
70-
<HintPath>c:\temp\nuget\Costura.Fody.4.1.0\lib\net40\Costura.dll</HintPath>
70+
<HintPath>..\packages\Costura.Fody.4.1.0\lib\net40\Costura.dll</HintPath>
7171
</Reference>
7272
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
73-
<HintPath>c:\temp\nuget\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
73+
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
7474
</Reference>
7575
<Reference Include="System" />
7676
<Reference Include="System.Configuration.Install" />
@@ -529,8 +529,8 @@
529529
<PropertyGroup>
530530
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
531531
</PropertyGroup>
532-
<Error Condition="!Exists('c:\temp\nuget\Costura.Fody.4.1.0\build\Costura.Fody.props')" Text="$([System.String]::Format('$(ErrorText)', 'c:\temp\nuget\Costura.Fody.4.1.0\build\Costura.Fody.props'))" />
533-
<Error Condition="!Exists('c:\temp\nuget\Fody.6.6.3\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', 'c:\temp\nuget\Fody.6.6.3\build\Fody.targets'))" />
532+
<Error Condition="!Exists('..\packages\Costura.Fody.4.1.0\build\Costura.Fody.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Costura.Fody.4.1.0\build\Costura.Fody.props'))" />
533+
<Error Condition="!Exists('..\packages\Fody.6.6.3\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.6.6.3\build\Fody.targets'))" />
534534
</Target>
535-
<Import Project="c:\temp\nuget\Fody.6.6.3\build\Fody.targets" Condition="Exists('c:\temp\nuget\Fody.6.6.3\build\Fody.targets')" />
535+
<Import Project="..\packages\Fody.6.6.3\build\Fody.targets" Condition="Exists('..\packages\Fody.6.6.3\build\Fody.targets')" />
536536
</Project>

0 commit comments

Comments
 (0)