Is there a way to overlay text on NotifyIcon?

I am currently writing an application with NotifyIcon, and I'm trying to figure out a way to overlay text on it. For example, if the icon indicates the number of open files, it has an icon plus a number on top of it.

Is there any way to do this? I saw instances of NotifyIcon just for text, like SpeedFan.

Any suggestions or links would be appreciated.

+3
source share
3 answers

Add a link to System.Drawing. The following code is taken from one of my applications, it uses the icon 2on the icon.

Graphics canvas;
Bitmap iconBitmap = new Bitmap(16, 16);
canvas = Graphics.FromImage(iconBitmap);

canvas.DrawIcon(YourProject.Resources.YourIcon, 0, 0);

StringFormat format = new StringFormat();
format.Alignment = StringAlignment.Center;

canvas.DrawString(
    "2",
    new Font("Calibri", 8, FontStyle.Bold),
    new SolidBrush(Color.FromArgb(40, 40, 40)),
    new RectangleF(0, 3, 16, 13),
    format
);

notifyIcon.Icon = Icon.FromHandle(iconBitmap.GetHicon());
+6
source

- . -, System.Drawing. , . , , .

+1

Well, I did not understand how to do this, but in the end it did not matter. I ended up using BalloonTip, which allowed me to provide information.

0
source

Source: https://habr.com/ru/post/1720221/


All Articles