问个弱弱的问题,cmenu图标不是透明背景怎么设置?

#Page# 2016-08-08 02:31:29
用bitmap怎么设置?用icon也不行,看我效果:



popmenu.SetMenuItemBitmaps(ID_RICH_COPY, MF_BYCOMMAND, ConvertIconToBitmap(m_hICOCopy), NULL);

converticontobitmap是我写的函数,然而用bitmap也不行,大侠指点下?
...全文
414 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
#Page# 2016-08-08
  • 打赏
  • 举报
回复
mfc真是个奇葩的库,直接支持png不就得了。。。。。
路杨 2016-08-08
  • 打赏
  • 举报
回复
引用 4 楼 lanmanck 的回复:
[quote=引用 3 楼 easunlee 的回复:] https://msdn.microsoft.com/en-us/library/windows/desktop/ms647998 === The selected and clear bitmaps should be monochrome. The system uses the Boolean AND operator to combine bitmaps with the menu so that the white part becomes transparent and the black part becomes the menu-item color. If you use color bitmaps, the results may be undesirable. == 也就是说这个函数其实只是替换默认的 check 和 uncheck 的图片。 支持单色。如果不是单色也能显示。但是不会去除底色。 == 要实现高彩图片图片菜单,不能直接用 这个函数,还是派生、自绘吧。
派生自绘可以是可以,不过要匹配系统主题就比较麻烦。现在抛开icon,直接用bitmap也不可以吗?就实现非常简单的图标而已。。。。[/quote] 我遇见的是和你一样的问题。 用 SetMenuItemBitmaps ,那么就只能接受其移动鼠标上去不透明,或者设计 正方形的图片。这样就不存在透明不透明问题了。
#Page# 2016-08-08
  • 打赏
  • 举报
回复
引用 3 楼 easunlee 的回复:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms647998 === The selected and clear bitmaps should be monochrome. The system uses the Boolean AND operator to combine bitmaps with the menu so that the white part becomes transparent and the black part becomes the menu-item color. If you use color bitmaps, the results may be undesirable. == 也就是说这个函数其实只是替换默认的 check 和 uncheck 的图片。 支持单色。如果不是单色也能显示。但是不会去除底色。 == 要实现高彩图片图片菜单,不能直接用 这个函数,还是派生、自绘吧。
派生自绘可以是可以,不过要匹配系统主题就比较麻烦。现在抛开icon,直接用bitmap也不可以吗?就实现非常简单的图标而已。。。。
路杨 2016-08-08
  • 打赏
  • 举报
回复
https://msdn.microsoft.com/en-us/library/windows/desktop/ms647998 === The selected and clear bitmaps should be monochrome. The system uses the Boolean AND operator to combine bitmaps with the menu so that the white part becomes transparent and the black part becomes the menu-item color. If you use color bitmaps, the results may be undesirable. == 也就是说这个函数其实只是替换默认的 check 和 uncheck 的图片。 支持单色。如果不是单色也能显示。但是不会去除底色。 == 要实现高彩图片图片菜单,不能直接用 这个函数,还是派生、自绘吧。
#Page# 2016-08-08
  • 打赏
  • 举报
回复
引用 1 楼 VisualEleven 的回复:
http://www.codeproject.com/Articles/408251/Bitmap-Menu
我就是那他的函数做的,截图如上。。。。

15,979

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧