本文主要是介绍MFC3d立体按钮制作,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
1、本程序基于前期我的博客文章MFC用CButtonST类实现图片透明按钮(免费源码下载)
2、添加CeXDib.cpp CeXDib.h ShadeButtonST.cpp ShadeButtonST.h到项目文件夹下,和FileView中如图。
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立体按钮制作的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!