Closed cqjdcheng closed 3 years ago
var powerLineStatus = powerStatus.PowerLineStatus; batteryPercentage = (powerStatus.BatteryLifePercent * 100).ToString(); var bg_color = Color.Green; if (int.Parse(batteryPercentage) < 60) { bg_color = Color.Orange; } if (int.Parse(batteryPercentage) < 30) { bg_color = Color.Red; } if (powerLineStatus== PowerLineStatus.Online) { bg_color = Color.Green; } using (Bitmap bitmap = new Bitmap(DrawText(batteryPercentage, new Font(iconFont, iconFontSize), Color.White, bg_color)))
Thanks for the Code but can u explain a little how do i edit percentage.exe to use this code?
Thanks cqjdcheng this might be a bit out of scope for where I'd like to take the project, feel free to fork the project though
ajtazer you can update the GetTextBitmap method to change how the background color is initialized
This piece of code is setting the background color
graphics.Clear(Color.FromArgb(0, 0, 0, 0));
var powerLineStatus = powerStatus.PowerLineStatus; batteryPercentage = (powerStatus.BatteryLifePercent * 100).ToString(); var bg_color = Color.Green; if (int.Parse(batteryPercentage) < 60) { bg_color = Color.Orange; } if (int.Parse(batteryPercentage) < 30) { bg_color = Color.Red; } if (powerLineStatus== PowerLineStatus.Online) { bg_color = Color.Green; } using (Bitmap bitmap = new Bitmap(DrawText(batteryPercentage, new Font(iconFont, iconFontSize), Color.White, bg_color)))