如何动态文本添加为任务栏图标叠加? [英] How to add dynamic text as Taskbar Icon overlay?
本文介绍了如何动态文本添加为任务栏图标叠加?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想补充的任务栏图标叠加文本到Windows7的应用程序图标,我还是设法增加小覆盖,但无法添加文本。
I'm trying add Taskbar Icon overlay with text to windows7 application icon, I did manage to add small overlay but unable to add the text.
没有任何一个?知道如何动态文本添加为任务栏图标叠加
Does any one know how to add dynamic text as Taskbar Icon overlay?
使用:WPF和C#
推荐答案
您只能添加一个图片
,所以你必须创建一个:
You can only add an Image
so you have to create that:
RectangleF rectF = new RectangleF(0, 0, 40, 40);
Bitmap bitmap = new Bitmap(40, 40, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
Graphics g = Graphics.FromImage(bitmap);
g.FillRectangle(System.Drawing.Brushes.White, 0, 0, 40, 40);
g.DrawString("5", new Font("Arial", 25), System.Drawing.Brushes.Black, new PointF(0, 0));
IntPtr hBitmap = bitmap.GetHbitmap();
ImageSource wpfBitmap =
Imaging.CreateBitmapSourceFromHBitmap(
hBitmap, IntPtr.Zero, Int32Rect.Empty,
BitmapSizeOptions.FromEmptyOptions());
TaskbarItemInfo.Overlay = wpfBitmap;
这篇关于如何动态文本添加为任务栏图标叠加?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文