简体   繁体   English

图像透明度不起作用

[英]Image Transparency not working

I am using Windows 8 RTM and Visual Studio Express 2012 for Windows Desktop. 我正在使用Windows 8 RTM和Windows Studio的Visual Studio Express 2012。 I am trying to write an application that uses UIRibbon in Visual C++. 我正在尝试编写在Visual C ++中使用UIRibbon的应用程序。 (Because I have the Express version only, I don't have access to MFC; please don't use it in your answer.) (因为我只有Express版本,所以我无法访问MFC;请不要在答案中使用它。)

The problem has to do with the icons I use in the ribbon. 问题与我在功能区中使用的图标有关。 Because Windows 7 compatibility is a requirement for this project, I cannot use PNG images; 因为Windows 7兼容性是该项目的要求,所以我不能使用PNG图像。 I am stuck with old-school BMPs. 我坚持使用老式BMP。 The problem is that, while some of the BMPs are displaying correctly, most of the images have black bounding-boxes around them. 问题是,尽管某些BMP可以正确显示,但是大多数图像周围都有黑色的边框。 I suspect the problem has to do with the BMP files, and is not in the ribbon XML file or in the code. 我怀疑问题与BMP文件有关,而不是在功能区XML文件或代码中。

The BMP that displays correctly I downloaded off the Internet as part of a sample that I adapted. 正确显示的BMP是我从互联网上下载的,这是我修改的样本的一部分。 The BMPs that don't display correctly I extracted from an ICO file, then converted to a 32-bit image using the System.Drawing.Bitmap .NET API. 我从ICO文件中提取了无法正确显示的BMP,然后使用System.Drawing.Bitmap .NET API将其转换为32位图像。 (This conversion process is in done in a separate program as part of my build procedure, not at runtime.) (此转换过程作为构建过程的一部分在单独的程序中完成,而不是在运行时完成。)

My question is: Does changing the bit depth of a BMP in this manner affect the colors in the image? 我的问题是:以这种方式更改BMP的位深度是否会影响图像中的颜色? And, if so, can anyone point out a free tool that can turn a PNG file into a 32-bit BMP file that works correctly in the Windows UIRibbon ? 并且,如果是这样,谁能指出一个免费工具,该工具可以将PNG文件转换为在Windows UIRibbon正常工作的32位BMP文件?

Do you speak of the Windows Ribbon Framework here? 您在这里谈论Windows Ribbon Framework吗? If so, you wouldn't be able to use PNGs anyway as the framework supports BMP only for Windows 7. With Windows 8 you can also use PNGs. 如果是这样,您将无法使用PNG,因为该框架仅支持Windows 7 BMP。在Windows 8中,您也可以使用PNG。 See the regarding M SDN article for more information. 有关更多信息,请参见有关M SDN的文章

For a free tool which converts your PNGs into compatible BMP files, you should have a look at the visual designer that comes with the " Windows Ribbon Framework for Delphi ". 对于免费的工具,它将您的PNG转换为兼容的BMP文件,您应该看看“ Windows Delphi的Windows Ribbon Framework ”随附的视觉设计器。

You can simply load you XML markup into the editor and add your pictures. 您可以简单地将XML标记加载到编辑器中并添加图片。 The editor will then convert the added files into BMPs if required. 然后,如果需要,编辑器会将添加的文件转换为BMP。 You can also use the editor to check if your Ribbon definition looks right. 您还可以使用编辑器检查功能区定义是否正确。 It produces valid "Windows Ribbon Framework" XML markup, so you can use the markup file in any other language such as C++, C# or Delphi for your further application development. 它会生成有效的“ Windows Ribbon Framework” XML标记,因此您可以使用其他任何语言(例如C ++,C#或Delphi)的标记文件来进行进一步的应用程序开发。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM