Skip to content

Commit e985a47

Browse files
committed
Update application icon to use logo.ico
1 parent 22012c4 commit e985a47

6 files changed

Lines changed: 35 additions & 24 deletions

File tree

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
# Assuming your version tags are standard like v1.5.2
2828
run: |
2929
$ver = "${{ github.ref_name }}".TrimStart('v')
30-
vpk pack -u WindowsSmartTaskbar -v $ver -p .\bin\Release\net8.0-windows\win-x64\publish -e WindowsSmartTaskbar.exe --skipVeloAppCheck
30+
vpk pack -u WindowsSmartTaskbar -v $ver -p .\bin\Release\net8.0-windows\win-x64\publish -e WindowsSmartTaskbar.exe -i logo.ico --skipVeloAppCheck
3131
3232
- name: Publish GitHub Release
3333
uses: softprops/action-gh-release@v2

MainForm.cs

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -758,29 +758,10 @@ private string T(string key)
758758
}
759759

760760
private Icon GenerateAppIcon() {
761-
using (Bitmap bmp = new Bitmap(256, 256)) {
762-
using (Graphics g = Graphics.FromImage(bmp)) {
763-
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
764-
g.Clear(Color.Transparent);
765-
766-
// Premium Background Gradient
767-
var rect = new Rectangle(10, 10, 236, 236);
768-
using (var path = new System.Drawing.Drawing2D.GraphicsPath()) {
769-
path.AddEllipse(rect);
770-
using (var brush = new System.Drawing.Drawing2D.LinearGradientBrush(rect, Color.FromArgb(0, 120, 215), Color.FromArgb(0, 40, 100), 45f)) {
771-
g.FillPath(brush, path);
772-
}
773-
}
774-
775-
// Stylized "S" / Checkmark Symbol
776-
using (Pen pen = new Pen(Color.White, 18)) {
777-
pen.StartCap = pen.EndCap = System.Drawing.Drawing2D.LineCap.Round;
778-
g.DrawLine(pen, 70, 130, 110, 170);
779-
g.DrawLine(pen, 110, 170, 180, 80);
780-
}
781-
}
782-
IntPtr hIcon = bmp.GetHicon();
783-
return Icon.FromHandle(hIcon);
761+
try {
762+
return Icon.ExtractAssociatedIcon(Application.ExecutablePath) ?? SystemIcons.Application;
763+
} catch {
764+
return SystemIcons.Application;
784765
}
785766
}
786767

WindowsSmartTaskbar.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
<AssemblyTitle>WindowsSmartTaskbar</AssemblyTitle>
1111
<Description>En smart taskbar för att hantera och starta Windows-program</Description>
1212
<EnableWindowsTargeting>true</EnableWindowsTargeting>
13+
<ApplicationIcon>logo.ico</ApplicationIcon>
1314
</PropertyGroup>
1415

1516
<ItemGroup>

logo.ico

71.8 KB
Binary file not shown.

logo.png

806 KB
Loading

make_ico.ps1

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
Add-Type -AssemblyName System.Drawing
2+
$pngPath = "logo.png"
3+
$icoPath = "logo.ico"
4+
$src = [System.Drawing.Image]::FromFile($pngPath)
5+
$size = 256
6+
$bmp = new-object System.Drawing.Bitmap($size, $size)
7+
$g = [System.Drawing.Graphics]::FromImage($bmp)
8+
$g.InterpolationMode = [System.Drawing.Drawing2D.InterpolationMode]::HighQualityBicubic
9+
$g.DrawImage($src, 0, 0, $size, $size)
10+
$ms = new-object System.IO.MemoryStream
11+
$bmp.Save($ms, [System.Drawing.Imaging.ImageFormat]::Png)
12+
$pngBytes = $ms.ToArray()
13+
14+
$fs = new-object System.IO.FileStream($icoPath, [System.IO.FileMode]::Create)
15+
$bw = new-object System.IO.BinaryWriter($fs)
16+
$bw.Write([int16]0)
17+
$bw.Write([int16]1)
18+
$bw.Write([int16]1)
19+
$bw.Write([byte]0)
20+
$bw.Write([byte]0)
21+
$bw.Write([byte]0)
22+
$bw.Write([byte]0)
23+
$bw.Write([int16]1)
24+
$bw.Write([int16]32)
25+
$bw.Write([int32]$pngBytes.Length)
26+
$bw.Write([int32]22)
27+
$bw.Write($pngBytes)
28+
$bw.Close()
29+
$fs.Close()

0 commit comments

Comments
 (0)