My MFC dialog app which was working ok in XP has started exhibiting some strange behaviour concerning MFC buttons.
I have a function to set the button text and style, but bizarrely, when the text is too long to fit the button and is wrapped, the button seems to 'forget' the BS_CENTER attribute and left aligns.
I should say that I'm using the "classic" style with the Themes services deactived. Even if this is avtivated, the behaviour is the same. If I go back to Windows 7 themes, then the button text centers correctly, but this isn't the look I want.
Any idea how to get the buttons to behave properly in Classic theme in Win7?
This is my code:
void CMain::SetButtonText(CWnd* ptr, std::string button_text )
int test = 0;
test = ptr->ModifyStyle(0, BS_MULTILINE , 0);
test = ptr->ModifyStyle(0, BS_CENTER, 0 );
When I debug step by step, ModifyStyle returns TRUE, and the std::string is correct (no white spaces).
Also, when I comment out the style setting and use the VS button properties, the result is the same.
Any ideas? Or is this a limitation of Windows 7? (I'm beginning to think it is).