Adding CStatic Icon to a dialog box
-
I am trying to add a CStatic item in the form of an icon to a dialog box and I am having no luck... I have added this code to the OnInitDialog section: CStatic myStatic; myStatic.Create(_T("my static"), WS_CHILD|WS_VISIBLE|SS_ICON|SS_CENTERIMAGE, CRect(10,10,150,50), this); myStatic.SetIcon( ::LoadIcon(NULL, IDI_QUESTION) ); Is there anything wrong that I am doing?
-
I am trying to add a CStatic item in the form of an icon to a dialog box and I am having no luck... I have added this code to the OnInitDialog section: CStatic myStatic; myStatic.Create(_T("my static"), WS_CHILD|WS_VISIBLE|SS_ICON|SS_CENTERIMAGE, CRect(10,10,150,50), this); myStatic.SetIcon( ::LoadIcon(NULL, IDI_QUESTION) ); Is there anything wrong that I am doing?
You can do that this way: 1. Insert a picture control on your Dialog. 2. In properties of this control enter Type: Icon and Image: IDI_QUESTION. Jerzy
-
You can do that this way: 1. Insert a picture control on your Dialog. 2. In properties of this control enter Type: Icon and Image: IDI_QUESTION. Jerzy
-
Add CStatic myStatic in your class. In OnInitDialog(): myStatic.Create(_T("my static"), WS_CHILD|WS_VISIBLE|SS_ICON|SS_CENTERIMAGE, CRect(10,10,150,50), this); myStatic.SetIcon(::LoadIcon(::AfxGetInstanceHandle(),MAKEINTRESOURCE(IDI_QUESTION)));
-
Add CStatic myStatic in your class. In OnInitDialog(): myStatic.Create(_T("my static"), WS_CHILD|WS_VISIBLE|SS_ICON|SS_CENTERIMAGE, CRect(10,10,150,50), this); myStatic.SetIcon(::LoadIcon(::AfxGetInstanceHandle(),MAKEINTRESOURCE(IDI_QUESTION)));
And one more question... I am trying to use icon 161 in shell32.dll... The default Icon in the file actually has a green background, but typically this background is not shown in Windows dialogs. How do you make the background match the background of the dialog while the rest of items retain their original color?