1.在头文件.h中定义HICON类型的变量
HICON m_hPlayEnableIcon;
2.在资源中导入icon图片
3.在对应构造函数中初始化变量
m_hPlayEnableIcon = AfxGetApp()->LoadIcon(IDI_PLAY_ENABLE);
4.下面这个是在Button控件上添加图标
CButton *pButton;
pButton = (CButton *)GetDlgItem(IDC_BUTTON_PLAY_BYTIME);
pButton->SetIcon(m_hPlayEnableIcon);
pButton->EnableWindow(TRUE);
属性上
Icon 选项要改成 True