/*
//从相对路径加载BMP
void CSkinTab::SetSkin(int nIndex, CString strNormal, CString strOver, CString strDown)
{
ASSERT(nIndex < m_nTabCount);
if (m_pTabBmpNormal[nIndex].m_hObject)
m_pTabBmpNormal[nIndex].Detach();
if (m_pTabBmpOver[nIndex].m_hObject)
m_pTabBmpOver[nIndex].Detach();
if (m_pTabBmpDown[nIndex].m_hObject)
m_pTabBmpDown[nIndex].Detach();
HBITMAP bm = (HBITMAP)::LoadImage(NULL,strNormal,IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
m_pTabBmpNormal[nIndex].Attach(bm);
bm = (HBITMAP)::LoadImage(NULL,strOver,IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
m_pTabBmpOver[nIndex].Attach(bm);
bm = (HBITMAP)::LoadImage(NULL,strDown,IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
m_pTabBmpDown[nIndex].Attach(bm);
}
//从资源文件加载BMP
void CSkinTab::SetSkin(int nIndex, UINT nNormalID, UINT nOverID, UINT nDownID)
{
ASSERT(nIndex < m_nTabCount);
if (m_pTabBmpNormal[nIndex].m_hObject)
m_pTabBmpNormal[nIndex].Detach();
if (m_pTabBmpOver[nIndex].m_hObject)
m_pTabBmpOver[nIndex].Detach();
if (m_pTabBmpDown[nIndex].m_hObject)
m_pTabBmpDown[nIndex].Detach();
m_pTabBmpNormal[nIndex].LoadBitmap(nNormalID);
m_pTabBmpOver[nIndex].LoadBitmap(nOverID);
m_pTabBmpDown[nIndex].LoadBitmap(nDownID);
}
//从相对路径加载ICO
void CSkinTab::SetIcon(int nIndex, CString strIcon)
{
ASSERT(nIndex < m_nTabCount);
m_phIcon[nIndex] = (HICON)::LoadImage(AfxGetApp()->m_hInstance,strIcon,IMAGE_ICON,24,24,LR_LOADFROMFILE);
}
//从资源文件加载ICO
// 1. 打开ICON按钮的属性页,在Style中选中Icon 。
// 2. 在对话框类的头文件中定义成员变量(使用ClassWizard加入这个成员变量)
// CButton m_IconBtn;//对应于图标按钮
// 3. 创建相应的图标或者位图资源:
// 图标资源:IDI_ICONBUTTON
// 4.在初始化中加入如下代码:
// …
// //对应于图标按钮
// HICON hIcon=AfxGetApp()->LoadIcon(IDI_ICONBUTTON);
// m_IconBtn.SetIcon(hIcon);
*/
回复 更多评论