Code Used:
m_pButton->Create(L"ABC", WS_CHILD | WS_VISIBLE| BM_SETIMAGE,CRect(0,0,100,100),this,ID_BUTTON1);
m_pButton->SetIcon(::LoadIcon(AfxGetApp()->m_hInstance, MAKEINTRESOURCE(IDI_ICON1)));
//above Code show neither showing image nor showing text.
You might use CMFCButton if you are using VS 2008 SP1 or higher.
BM_SETIMAGE is not a button style, but a message which is sent to the window in order to set a bitmap. What you probably want is the BS_BITMAP style. Unfortunately as far as I know, it is not possible to have both text and a bitmap on a standard button. But you should find plenty of working implementations of a custom button class on sites like codeguru or codeproject.
BS_ICON and BS_BITMAP must be both unset to enable icon and text on the same button.
See https://msdn.microsoft.com/en-us/library/bb761822(VS.85).aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With