如何将动态文本添加为​​任务栏图标叠加?

Pra*_*dda 2 c# wpf icons taskbar windows-7

我正在尝试将带有文本的任务栏图标叠加添加到windows7应用程序图标,我确实设法添加小叠加但无法添加文本.

有没有人知道如何添加动态文本作为任务栏图标叠加?

使用:WPF和C#

小智 5

你只能添加一个,Image所以你必须创建:

    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;
Run Code Online (Sandbox Code Playgroud)