請問怎樣才能插入ICO圖示檔案,找到的代碼好像只能插入位圖檔案,這樣背景不是透明的,謝謝了!
uj5u.com熱心網友回復:
https://www.codeproject.com/articles/2354/owner-drawn-menu-with-icons-titles-and-shadinguj5u.com熱心網友回復:
搜 自繪選單欄uj5u.com熱心網友回復:
可以使用PNG圖片、
// 加載圖片
HBITMAP hbitmap;
HRESULT ret = m_Image.Load(stream);
if (S_OK==ret&&m_Image.GetBPP() == 32)
{
for (int i=0;i<m_Image.GetWidth();i++)
{
for (int j=0;j<m_Image.GetHeight();j++)
{
unsigned char* pucColor = reinterpret_cast<unsigned char *>(m_Image.GetPixelAddress(i , j));
pucColor[0] = pucColor[0] * pucColor[3] / 255;
pucColor[1] = pucColor[1] * pucColor[3] / 255;
pucColor[2] = pucColor[2] * pucColor[3] / 255;
}
}
hbitmap = m_Image.Detach();
}
m_Image.Destroy();
//設定選單項圖示
::SetMenuItemBitmaps(pMenum->m_hMenu, j, MF_BYPOSITION, hbitmap, hbitmap);//設定選單項
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/7427.html
標籤:基礎類
