CButton or CMFCButton with image

  • Thread starter Thread starter flaviu_
  • Start date Start date
F

flaviu_

Guest
I need a button that has image instead of text and to keep that images as my commands. And to has SizeToContent method, of course.

For that, I have tried CButton, with SetBitmap method: CButton Class

The problem here is that CButton has not SizeToBitmap. To have that, I switched CButton to CMFCButton. This class has SizeToContent and SetImage CMFCButton Class

The problem here is I cannot change the image at my command. My trial:

At OnInitialUpdate:

m_Button.EnableWindowsTheming(TRUE);
m_Button.m_nFlatStyle = CMFCButton::BUTTONSTYLE_3D;
m_Button.m_bTransparent = FALSE;

m_Button.SetImage(IDB_bmp00010);
m_Button.SizeToContent();


and at some handler, I am try to change the image:

// m_Button.CleanUp(); // with or without this method is the same behavior
m_Button.SetImage(IDB_BITMAP1);


Is there possible to change the image dynamically at run time ?

Continue reading...
 
Back
Top