将通知图标与文本叠加
经过一些帮助后,我使用 windows.forms notifyIcon 类获得了 WPF(这不是一个主要的应用程序,所以不用担心纯度)。我想知道是否可以在 icom 上覆盖一些文本?
基本上我需要它来直观地显示我的网格视图中有多少条目。并在每次 SizeChanged 事件时运行它。这是我到目前为止所想到的,但不确定如何从这里继续。
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。我无法使用 Philipp Sumi 的 NotifyIcon 模块)
谢谢,Psy
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您似乎正在尝试在图像/图标顶部添加水印。有关详细信息,请查看以下网站: http://www.c -sharpcorner.com/UploadFile/scottlysle/WatermarkCS05072007024947AM/WatermarkCS.aspx
您将能够在原始图标图形的顶部添加自定义文本。如果您不经常更新,这是一个很好的解决方案 - 但如果它会在短时间内运行多次(我在这里考虑进度条),您将为您的程序添加不必要的延迟。
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.