能否在来自 MFC 的 CToolBar 控制器上显示32 位图像, 带有 Alpha 频道的图像? 目前, 我的工具栏使用一个 4 位图像, 由2010 视觉工作室的“ 文件名” 属性指派给它 。
提前感谢!
能否在来自 MFC 的 CToolBar 控制器上显示32 位图像, 带有 Alpha 频道的图像? 目前, 我的工具栏使用一个 4 位图像, 由2010 视觉工作室的“ 文件名” 属性指派给它 。
提前感谢!
但我也有同样的问题 所以万一有人在寻找解决办法
带有 8 位元 alpha 的 32 位图像将至少在 XP 和 更新器上工作。 您需要一个 BMP 文件, 格式为 32 位元 Alpha BMP 格式, 许多应用程序无法正确保存 。 我的方法是先生成 PNG 图像, 然后使用这个小工具将其转换为 32 位 BMP : < a href="https://github.com/thomerow/png2bmp32" rel= “ no follow" >https://github. com/thomerow/png2bmp32
Once you have such a file, it should be loadable using toolbar.LoadBitmap(...)
without problems.
In case you re using an image list for the toolbar, or if you want to use an image list to display icons in some other control such as a treeview, load the image like this:
CBitmap bitmap;
bitmap.LoadBitmap(...);
imageList.Create(WIDTH_OF_ICONS, HEIGHT_OF_ICONS, ILC_COLOR32, NUMBER_OF_IMAGES, 1);
imageList.Add(&bitmap, RGB(255, 0, 255)); // Color key isn t important.
bitmap.Detach();
希望这有帮助!
EDIT: 我注意到“ 简单” < code> LooadBitmap () () < /code > 在某种程度上在此64位构建中无法工作。 我使用上述图像列表的方法, 与 toolbar. GetToolBarCtrl (). SetImageList ( & amp;imageList);
组合使用上述图像列表。 GetToolBarCtrl (). SetImageList( & amp;imageList); 。
我也有类似的问题。 问题的起因是位图版本。 需要的版本是版本 3 bmp v3, < a href="https:// en.wikipedia. org/ wiki/ BMP_ file_format" rel = "nofollow noreferrer" > bmp wiki 。 但是默认值为 24 位深度, 不包括阿尔法频道 。
我用
然后,我用
我使用的命令是:
magick convert png_asset_name.png -define bmp3:alpha=on bmp3:new_bmp_asset_name.bmp
使用 CMFCToolbar 而不是 CToolbar 使用 Alpha 频道的32位位图像。 此类属于 MFC 2008 特性包( VS2008 SP1), 并已包含在 VS2010 。 但是 Yoy 不仅需要升级工具栏, 还需要更新其它东西( CWinApp 到 CWinAppEx 等) 。 请查看 < a href=" http://www.codeproject.com/ articles/217788/ Porting- a-legic-MFCC- app-to- MFCC- Feature-Pack" rel= “ nofolvection” > this 。
你是否看过" http://www.codeguru.com/cpp/control/imagelist/imagelist/openfaq/article.php/c9045/True-Color-Imaage-List.htm" rel =“nofollow” > this ? 这家伙从CToolBar中衍生出一个能够使用32位色的类。 我希望这对你来说足够。
I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...
I have been searching for sample code creating iterator for my own container, but I haven t really found a good example. I know this been asked before (Creating my own Iterators) but didn t see any ...
Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...
I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?
Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...
Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...
I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...
Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?