tags:

views:

69

answers:

1

Hey Guys,

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:,,,/ReturnJourneyPreparation;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

+1  A: 

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.

Alex
This looks like near enough what I'm after, I'll have a deeper look at the code later, but the outcome it provides is what I'm after, just need to adapt it to me needs :)
Psytronic