CStatic ModifyStyle
-
I don't know why can not modify style at runtime : at design time style of CStatic is Frame , and in OnInitDialog I try :
m\_staticIcon.ModifyStyle(0,SS\_BITMAP | SS\_CENTERIMAGE); m\_staticIcon.SetBitmap(::LoadBitmap(AfxGetApp()->m\_hInstance, MAKEINTRESOURCE(IDB\_BITMAP1)));
but didn't working at all ( I seen nothing on dialog ) ... what I should to do modify style in SS_BITMAP ? Thank you.
-
I don't know why can not modify style at runtime : at design time style of CStatic is Frame , and in OnInitDialog I try :
m\_staticIcon.ModifyStyle(0,SS\_BITMAP | SS\_CENTERIMAGE); m\_staticIcon.SetBitmap(::LoadBitmap(AfxGetApp()->m\_hInstance, MAKEINTRESOURCE(IDB\_BITMAP1)));
but didn't working at all ( I seen nothing on dialog ) ... what I should to do modify style in SS_BITMAP ? Thank you.
My bet is that as the CBitmap is a local object it goes out of scope at the end of the function and its destructor cleans up its memory usage and deletes the bitmap you loaded. Try making it a member variable instead. The above is an answer from another question, however I think it applies. Member varibles in the class, tend to be less volitile. If the varible is in your "CMyDoument" class, it is more prone to persistance.
The World as we think we know it Has a lot more to it than meets the eye. A Mad Scientist who has seen it for himself....
-
I don't know why can not modify style at runtime : at design time style of CStatic is Frame , and in OnInitDialog I try :
m\_staticIcon.ModifyStyle(0,SS\_BITMAP | SS\_CENTERIMAGE); m\_staticIcon.SetBitmap(::LoadBitmap(AfxGetApp()->m\_hInstance, MAKEINTRESOURCE(IDB\_BITMAP1)));
but didn't working at all ( I seen nothing on dialog ) ... what I should to do modify style in SS_BITMAP ? Thank you.
Try also removing the old style (first parameter of ModifyStyle), however, not every style can be changed at runtime, i don't know which can and can't, you should google it up.
> The problem with computers is that they do what you tell them to do and not what you want them to do. < > //TODO: Implement signature here<