NotifyIcon的图像看起来很可怕,一旦形象结束了在系统托盘中很可怕、系统托盘、图像、形象

2023-09-03 15:05:47 作者:々飞吻狂魔

我在使用Visual Studio 2010,C#,在Windows 7上。

我添加了一个通知控制到我的项目,并将其设置为我已经导入到项目的图标。图标图像是真的很好看,如果我只是preVIEW它,但是一旦我跑我的code,看看它在系统托盘中,那么它真的很可怕,像边点缀,而不是直线和等。我曾尝试同一个文件的16×16 24×24,32×32和48×48,但我有可怕的后果。

我错过了什么?

  myNotifyIcon.Icon = SysDir.Properties.Resources.icon2_32_ico_rgba;
 

解决方案

编辑:的

我链接的信息似乎是犯罪嫌疑人在这一点上。试试吧,但如果它不能正常工作,那么我建议你修改你的问题发表了您所有实验的截图(每个图标的大小,以及它如何被缩放)。

原文:的

32x32x256是正确的大小和颜色深度根据此链接:

http://www.hhhh.org/cloister/csharp/icons/

但你必须构建一个图像时要非常小心:

取16x16x256形象,让它看起来不错 双击它32×32(注意不要模糊或重采样,如果在一个画图程序这样做)

原因在于Windows将调整的32×32的图像通过简单地扔像素客场3/4到16x16。上面的链接证明这一现象与一对夫妇的截图:

男网友当心 这种赌博网站可能已经盯上你了

我不知道有多少颜色深度pickyness(仅256色?)/重采样问题仍然在Windows 7上真实的,但它肯定似乎是在XP的情况。

I am using Visual Studio 2010, C#, on Windows 7.

I have added a notify control to my project and set it to an icon I have imported to the project. The icon image is really good looking if I just preview it, but once I run my code and see it in the system tray, then it's really terrible, like the sides are dotted instead of straight lines and so on. I have tried 16x16, 24x24, 32x32 and 48x48 of the same file but I am having terrible results.

Have I missed anything?

myNotifyIcon.Icon = SysDir.Properties.Resources.icon2_32_ico_rgba;

解决方案

Edit:

The info I am linking seems to be suspect at this point. Try it out, but if it isn't working, then I suggest you edit your question to post screenshots of all your experiments (each icon size and how it gets scaled).

Original:

32x32x256 is the right size and color depth according to this link:

http://www.hhhh.org/cloister/csharp/icons/

But you have to be very careful when constructing that image:

Take a 16x16x256 image, and get it to look nice Double it to 32x32 (careful not to blur or resample if doing this in a paint program)

The reason is that Windows will "resize" the 32x32 image to 16x16 by simply throwing away 3/4 of the pixels. The link above demonstrates this phenomenon with a couple screenshots:

Before:

After:

I'm not sure how much of the color-depth pickyness (256 colors only?)/resampling issues are still true on Windows 7, but it certainly seems to be the case on XP.