Skip to content
This repository has been archived by the owner on Jan 1, 2024. It is now read-only.

No charging icon #29

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions percentage/percentage/TrayIcon.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Windows.Forms;
Expand All @@ -10,8 +10,8 @@ class TrayIcon
[DllImport("user32.dll", CharSet=CharSet.Auto)]
static extern bool DestroyIcon(IntPtr handle);

private const int fontSize = 18;
private const string font = "Segoe UI";
private const int fontSize = 20;
private const string font = "Franklin Gothic Medium Cond";

private NotifyIcon notifyIcon;

Expand All @@ -26,7 +26,7 @@ public TrayIcon()

menuItem.Click += new System.EventHandler(MenuItemClick);
menuItem.Index = 0;
menuItem.Text = "E&xit";
menuItem.Text = "Exit";

notifyIcon.ContextMenu = contextMenu;
notifyIcon.Visible = true;
Expand Down Expand Up @@ -73,7 +73,7 @@ private void TimerTick(object sender, EventArgs e)
PowerStatus powerStatus = SystemInformation.PowerStatus;
String percentage = (powerStatus.BatteryLifePercent * 100).ToString();
bool isCharging = SystemInformation.PowerStatus.PowerLineStatus == PowerLineStatus.Online;
String bitmapText = isCharging ? percentage + "*" : percentage;
String bitmapText = percentage;
using (Bitmap bitmap = new Bitmap(GetTextBitmap(bitmapText, new Font(font, fontSize), Color.White)))
{
System.IntPtr intPtr = bitmap.GetHicon();
Expand Down