Changing the bitmap for a CStatic object at runtime
Posted on 2000-03-15
I have this "picure" control (CStatic) which I want to have one of two bitmaps (a lightswitch depicting "on" or "off").
At runtime I want to click on the picture and have the bitmap switch from "on" to "off".
I set up the OnClick event for the CStatic object and this is the code I am using to switch the bitmap:
Don't ask me why I am subclassing the dialog item. I don't even know if this is necessary. I have been going through several books trying to gather bits and pieces of how this works.
What happens right now is when I click on the CStatic object the bitmap disappears completely.
Anyway, here is the code for my OnClick event:
HINSTANCE appinstance = AfxGetInstanceHandle();