Make icon above text for MFC Button
c++, mfc, visual-c++
Solution
(according to the "NewControls" MFC sample).
To set an image in a CMFCButton use CMFCButton::SetImage. To set the image above (or below) the text you can use the undocumented variable m_bTopImage
appButton->m_bTopImage = TRUE;
FYI: the complete samples can be downloaded from : http://www.microsoft.com/en-us/download/details.aspx?id=5718
Problem
I wanted to create CMFCButton dynamically at runtime (Icon with Text on the button). The icon is created successfully but I wanted to display the icon above text. I want to implement "Image on Top" property found in Resource Editor for the button. My Code: ``` CMFCButton* appButton = new CMFCButton; appButton->Create( _T("MfcButton1"), WS_CHILD | WS_VISIBLE, CRect(10, 10, 70, 50), this ); appButton->SetIcon( sfi.hIcon ); ```