MFC的图形按钮(CBitmapButton
)对有透明要求的按钮,实现起来比较吃力,由于某项目需要用到此类控件(异形按钮
、异形图标
等),所以开始学着制作。
目前的异形按钮类初步定名为CImageButton
(CBitmapButton
通过内部四个CBitmap
对象实现图形化的CButton
,CImageButton
通过内部四个CImage
对象实现异形),异形图标暂未开始。
#ifndef _LIB
#ifdef _WIN64
#ifdef _DEBUG
#ifdef _UNICODE
#pragma comment(lib,"lib/ImageButtondu_x64.lib")
#else
#pragma comment(lib,"lib/ImageButtond_x64.lib")
#endif // _UNICODE
#else
#ifdef _UNICODE
#pragma comment(lib,"lib/ImageButtonu_x64.lib")
#else
#pragma comment(lib,"lib/ImageButton_x64.lib")
#endif // _UNICODE
#endif // _DEBUG
#else
#ifdef _DEBUG
#ifdef _UNICODE
#pragma comment(lib,"lib/ImageButtondu.lib")
#else
#pragma comment(lib,"lib/ImageButtond.lib")
#endif // _UNICODE
#else
#ifdef _UNICODE
#pragma comment(lib,"lib/ImageButtonu.lib")
#else
#pragma comment(lib,"lib/ImageButton.lib")
#endif // _UNICODE
#endif // _DEBUG
#endif // _WIN64
#endif // ImageButton_EXPORTS
CImage m_bnImageU;
CImage m_bnImageD;
CImage m_bnImageF;
CImage m_bnImageX;
void LoadImagesFromFile(LPCTSTR pszFileName, int nImageNum = 4, BYTE cAlphaThreshold = 1);
void LoadImagesFromResource(LPCTSTR pszResourceName, int nImageNum = 4, BYTE cAlphaThreshold = 1, LPCTSTR lpImageResType = TEXT("PNG"));
void LoadImagesFromResource(UINT nReourceID, int nImageNum = 4, BYTE cAlphaThreshold = 1, LPCTSTR lpImageResType = TEXT("PNG"));
void ApplyImages(const CImage& wholeImage, int nImageNum = 4, BYTE cAlphaThreshold = 1);
原文:https://www.cnblogs.com/that-boy/p/12348155.html