Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

show count on minimized windows of your application in c#

Tags:

c#

Actually, I want something like skype does. if someone send two messages on skype; you see number "2" on minimized skype window. So, I want to know how can I show number/counts on minimized window of your c# application?

like image 529
Zaheer Mehmood Avatar asked Nov 02 '22 07:11

Zaheer Mehmood


1 Answers

If you are using WPF, you can use the TaskbarButtonInfo.Overlay property.

// draw an image to overlay
var dg = new DrawingGroup();
var dc = dg.Open();
dc.DrawEllipse(Brushes.Blue, new Pen(Brushes.LightBlue, 1), new Point(8, 8), 8, 8);
dc.DrawText(new FormattedText("3", System.Threading.Thread.CurrentThread.CurrentUICulture, System.Windows.FlowDirection.LeftToRight,
    new Typeface("Arial"), 16, Brushes.White), new Point(4, 0));
dc.Close();
var geometryImage = new DrawingImage(dg);
geometryImage.Freeze();

// set on this window
var tbi = new TaskbarItemInfo();
tbi.Overlay = geometryImage;

this.TaskbarItemInfo = tbi;

Produces
Taskbar button with an overlay of a circled number 3

If you are using Windows Forms, use Windows API Code Pack as documented in this related question.

like image 182
Mitch Avatar answered Nov 15 '22 05:11

Mitch