且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何调整Windows图标叠加?

更新时间:2023-02-08 19:23:37

您不能改变叠加尺寸。相反,使用多分辨率的图标文件,所有必要的尺寸可供选择。

You can't change the overlay size. Instead use a multi-resolution icon file where all necessary sizes are available.

对于一个很好的例子,看看到的source的TortoiseSVN 的。他们将只用一个图标文件,但如果你有一个适当的绘画工具打开它,你会看到这个文件包含不同的大小。

For a good example take a look into the source of TortoiseSVN. Their will be only one icon file used, but if you open it with an appropiate paint tool, you'll see that this file contains different sizes.

如果你在第一个方法看看吧,你会得到如下评论:

If you take a look right at the first method, you'll get the following comment:

壳牌调用IShellIconOverlayIdentifier :: GetOverlayInfo请求处理程序的图标叠加的
位置。图标叠加处理程序返回
包含覆盖图像文件的名称,它的$ b内指数$ b该文件。壳牌然后添加图标叠加系统图像列表。

"The Shell calls IShellIconOverlayIdentifier::GetOverlayInfo to request the location of the handler's icon overlay. The icon overlay handler returns the name of the file containing the overlay image, and its index within that file. The Shell then adds the icon overlay to the system image list."

您可以在129行,它看试图找出从注册表中所需要的文件的路径。通过浏览代码,你可以找到图标在这里颠覆。在线路165你可以看到,它需要的文件名从注册表,并将其写回到它的输出参数,也许魔术的标志,让窗口决定哪些大小应该从文件中采取的是 * pdwFlags = ISIOI_ICONFILE ;

You can see in line 129 that it tries to find out the path of the needed file from the registry. By browsing the code you can find the icons in subversion here. In line 165 you can see that it takes the filename from the registry and writes it back to its out parameters and maybe the magic flag to let windows decide which size should be taken from the file is *pdwFlags = ISIOI_ICONFILE;.