Why doesn't CStatic keep the size of the icon when using SetIcon?
-
Hi! I have a very simple class used to display a checkbox, filled or not depending on if a task is finished. I the dialog editor, I set the SS_REALSIZEIMAGE property. This works great, until the image is set using SetIcon. After that call, CStatic formats the icon as a 32x32, which I don't like. I've tried to use ModifyStyle and RedrawWindow after the call to SetIcon, but no success. My code: void CTaskFinishedCheck::SetFinished(BOOL bFinished) { if ( bFinished ) { SetIcon( hCheckedIcon ); } else { SetIcon( hUncheckedIcon ); } } Someone who knows?
-
Hi! I have a very simple class used to display a checkbox, filled or not depending on if a task is finished. I the dialog editor, I set the SS_REALSIZEIMAGE property. This works great, until the image is set using SetIcon. After that call, CStatic formats the icon as a 32x32, which I don't like. I've tried to use ModifyStyle and RedrawWindow after the call to SetIcon, but no success. My code: void CTaskFinishedCheck::SetFinished(BOOL bFinished) { if ( bFinished ) { SetIcon( hCheckedIcon ); } else { SetIcon( hUncheckedIcon ); } } Someone who knows?
Hi! Use the ::LoadImage API function instead of CWinApp::LoadIcon(). For example:
HINSTANCE hInst = AfxGetInstanceHandle();
hIcon = (HICON) ::LoadImage(hInst, MAKEINTRESOURCE(IDI_FOOBAR), IMAGE_ICON, 16, 16, 0);Hope this helps!
-
Hi! Use the ::LoadImage API function instead of CWinApp::LoadIcon(). For example:
HINSTANCE hInst = AfxGetInstanceHandle();
hIcon = (HICON) ::LoadImage(hInst, MAKEINTRESOURCE(IDI_FOOBAR), IMAGE_ICON, 16, 16, 0);Hope this helps!
-
Hi! Use the ::LoadImage API function instead of CWinApp::LoadIcon(). For example:
HINSTANCE hInst = AfxGetInstanceHandle();
hIcon = (HICON) ::LoadImage(hInst, MAKEINTRESOURCE(IDI_FOOBAR), IMAGE_ICON, 16, 16, 0);Hope this helps!