MFC3d立体按钮制作

1、本程序基于前期我的博客文章MFC用CButtonST类实现图片透明按钮(免费源码下载)
2、添加CeXDib.cpp CeXDib.h ShadeButtonST.cpp ShadeButtonST.h到项目文件夹下,和FileView中如图。
MFC3d立体按钮制作_第1张图片
MFC3d立体按钮制作_第2张图片
3、在ButtonShadeDlg.h中添加代码

#include "ShadeButtonST.h"
#include "BtnST.h"


class CButtonShadeDlg : public CDialog
{
// Construction
public:
	CButtonShadeDlg(CWnd* pParent = NULL);	// standard constructor

// Dialog Data
	//{{AFX_DATA(CButtonShadeDlg)
	enum { IDD = IDD_BUTTONSHADE_DIALOG };
	CButtonST   m_btnPrint;
	CShadeButtonST	m_btnCancel;
	CShadeButtonST	m_btnOK;
	//}}AFX_DATA
...
}

4、在ButtonShadeDlg.cpp中添加代码

void CButtonShadeDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CButtonShadeDlg)
DDX_Control(pDX, IDC_BUTTON1, m_btnPrint);
DDX_Control(pDX, IDCANCEL, m_btnCancel);
DDX_Control(pDX, IDOK, m_btnOK);
	//}}AFX_DATA_MAP
}


BOOL CButtonShadeDlg::OnInitDialog()
{
	CDialog::OnInitDialog();
m_btnPrint.SetIcon(IDI_ICON_Print);    
m_btnPrint.SetAlign(CButtonST::ST_ALIGN_VERT);
	m_btnOK.SetShade(CShadeButtonST::SHS_HARDBUMP);
	m_btnCancel.SetShade(CShadeButtonST::SHS_HARDBUMP);
...
}

运行程序
MFC3d立体按钮制作_第3张图片

你可能感兴趣的:(mfc,c++)