private void timerBattery_Tick(object sender, EventArgs e) { this.clockLbl.Text = DateTime.Now.ToString("HH:mm:ss"); BatteryLevel = BatteryInfo.GetBatteryLifePercent(); batteryBar.Value = BatteryLevel; if (BatteryLevel < 20) { this.batteryBar.ForeColor = Color.Red; } }
public HHTToolBar() { InitializeComponent(); this.clockLbl.Text = DateTime.Now.ToString("HH:mm:ss"); BatteryLevel = BatteryInfo.GetBatteryLifePercent(); batteryBar.Value = BatteryLevel; if (BatteryLevel < 20) { this.batteryBar.ForeColor = Color.Red; } }