Home > Software engineering >  After add images for button controls, how to cancel the picture again.
After add images for button controls, how to cancel the picture again.

Time:09-22

Now need to be on a button to add a instruction role,

Such as: there is a button button Caption: NO1
When the program received a warning message,
Program on this button to display a red light,
When people press the button, after the all-clear, red light out the button, button back appearance,

I now is implemented with the following statement:
HICON icon;
Icon [1]=AfxGetApp () - & gt; LoadIcon (IDI_Icon_Green);
Icon [0]=AfxGetApp () - & gt; LoadIcon (IDI_Icon_Red);

((CButton *) GetDlgItem (IDC_BUTTON_NO1)) - & gt; SetIcon (icon [0]);
((CButton *) GetDlgItem (IDC_BUTTON_NO1)) - & gt; SetIcon (icon [1]);
, originally wanted to without the alarm button to display the green,
Have alert, button displays a red light,
However, once the SetIcon, button font is covered by this Icon, could not see a button (no.) of the original word,

Problem: how to cancel the Icon, let NO1 displayed again?

I want to do is:
Program receiving data, if the received data containing the alarm information, the judgment which is the alarm number, and then in the corresponding number of buttons displayed on a red light,
Because there are many set of buttons, and size of trapped in interface layout, want to directly on the button shows the effect of light, in order to save the interface layout,

Show a red light, button no word can be overridden,
But once the all-clear, red light goes out, no need to be displayed,

CodePudding user response:

Add images again???

CodePudding user response:

From new CButton derived class, oneself handle WM_ERASEBKGND and WM_PAINT message

CodePudding user response:

The text do ICON so that a more appropriate!!!!!! UI look more comfortable all day,,,

CodePudding user response:

SetIcon (0);
  • Related