开发者

Overlaying Notification Icon with text

After some help here, I've got WPF using the windows.forms notifyIcon class (It's not a major app so not worried about purity). And I was wondering if its possible to overlay some text on the icom?

Basically I need it to visually show how many entries is in my gridview. And run this on everytime the SizeChanged event. This is what I have come up with so far, but not sure how to go on from here.

  Stream iconStream = Application.GetResourceStream(new Uri("pack://application:,,,/ReturnJour开发者_运维百科neyPreparation;component/Resources/favicon.ico")).Stream;
  System.Drawing.Icon notIcon = new Icon(iconStream);
  System.Drawing.Image canvas = new Bitmap(notIcon.Width, notIcon.Height);
  Graphics artist = Graphics.FromImage(canvas);
  artist.DrawString(_Messages.Count().ToString(), new Font("Arial", 4), System.Drawing.Brushes.Black, (float)(notIcon.Width), (float)(notIcon.Height));

(PS. I can't use Philipp Sumi's NotifyIcon module)

Thanks, Psy


It looks like you're trying to add a watermark on top of your image/icon. For more information check out the following site: http://www.c-sharpcorner.com/UploadFile/scottlysle/WatermarkCS05072007024947AM/WatermarkCS.aspx

You'll be able to add custom text on top of the original icon graphic. This is a great solution if you're not updating often--but if it's something that will be run many times in a short period of time (I'm thinking progress bar here) you'll be adding unneeded lag to your program.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜