NotifyIcon的图像编号 [英] Number to Image for NotifyIcon

查看:76
本文介绍了NotifyIcon的图像编号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

NotifyIcon的图像编号.给我一些创建它的想法.
NotifyIcon将根据条件进行更改.图标将由某些数据自动创建.
从数字创建图标是个问题.

Number to Image for NotifyIcon. gimme some idea to create it.
NotifyIcon will be changed upon condition. Icon will be created automatically by some data.
Creating the icon from number is the problem.

推荐答案

创建适当大小的新图像.
获取图像的Graphics对象(使用Graphics.FromImage)
以适当的字体和大小在图像上绘制数字(使用Graphics.DrawString).
处置图形对象.
根据需要使用图像.
Create a new image of the appropriate size.
Get the Graphics object for the image (using Graphics.FromImage)
Draw the number on the image (using Graphics.DrawString) in the appropriate font and size.
Dispose the graphics object.
Use the image as required.


Bitmap bmp = new Bitmap(16, 16);
using (Graphics g = Graphics.FromImage(bmp)) // Bmp with clear background of given color
Font drawFont = new Font("Arial", 16);
SolidBrush drawBrush = new SolidBrush(Color.Black);
string theNumber="8";
g.DrawString(theNumber,drawFont,drawBrush,new Point(100,100))
notifyIcon1.Icon = Icon.FromHandle(bmp.GetHicon());




另请参阅:

动态(安全地)生成图标 [




see also :

Dynamically Generating Icons (safely)[^]


这篇关于NotifyIcon的图像编号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆