我想在工具栏某个按钮的右上区域动态显示数字,类似360软件管家、软件升级图标上提示的数字
我想在工具栏某个按钮的右上区域动态显示数字,类似360软件管家、软件升级图标上提示的数字,如何实现的
[解决办法]
应该是事先做好了多个图标,打包到资源里面,按照IconFile和IconIndex去查询定位对应的数字
你可以用eXeScope看看管家的EXE和DLL文件,看看图标是怎么一回事
[解决办法]
TrayIcon,Hint的时候显示相应的数字信息
[解决办法]
偶收藏的,这是用JAVA写的,做个参考吧.
string
desktopPath
=
System.Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
IWshRuntimeLibrary.WshShell shell=new WshShell();
IWshRuntimeLibrary.WshShortcut shortcut = (IWshRuntimeLibrary.WshShortcut)shell.CreateShortcut(desktopPath
+
"//个人日记本.lnk");
string
exePath
=
Application.ExecutablePath;
//exe路径
string
dirPath=System.Environment.CurrentDirectory;
//directory路径
//画图部分
Bitmap
icoImg = new Bitmap(this.Icon.ToBitmap());
Graphics graIco = Graphics.FromImage(icoImg);
graIco.DrawString("1", new Font("Eras Medium
ITC",
icoImg.Width/3), new SolidBrush(Color.Red),
icoImg.Width-icoImg.Width/2,
0); Icon ico
=
Icon.FromHandle(icoImg.GetHicon());
string
icoName
=
dirPath
+
"\\cns.ico";
Stream stream = new FileStream(icoName,
FileMode.Create); ico.Save(stream); graIco.Dispose();
icoImg.Dispose(); //创建图标
shortcut.WorkingDirectory
=
dirPath;
shortcut.TargetPath = exePath;
shortcut.IconLocation = dirPath
+
"\\cns.ico,0";
shortcut.WindowStyle = 1;
shortcut.Save();