Skip to content

Instantly share code, notes, and snippets.

@puppis42
Created May 26, 2023 17:43
Show Gist options
  • Save puppis42/7310318c82a4ef8dd359f684cedd1f7a to your computer and use it in GitHub Desktop.
Save puppis42/7310318c82a4ef8dd359f684cedd1f7a to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Battery_Status
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void timer1_Tick(object sender, EventArgs e)
{
PowerStatus pw = SystemInformation.PowerStatus;
label1.Text = pw.BatteryLifePercent * 100 + "%";
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment