Answer:
CButton *btnsample = (CButton *)GetDlgItem(IDC_BUTTON1);
btnsample->ModifyStyle(0,BS_ICON,SWP_FRAMECHANGED); //change the style of CButton
HICON hIcon = ::LoadIcon(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDI_ICON)); //load an Icon assuming IDI_ICON is ID of ICON
btnsample->SetIcon(hIcon);
btnsample->ModifyStyle(0,BS_ICON,SWP_FRAMECHANGED); //change the style of CButton
HICON hIcon = ::LoadIcon(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDI_ICON)); //load an Icon assuming IDI_ICON is ID of ICON
btnsample->SetIcon(hIcon);
Previous Question | Next Question |
How to change the Text of a CButton at Runtime? | How to Enable and Disable CButton at runtime? |