Change the color of static control
-
I want to change the color of static control to white.As well as in the static controls the text also should be visible.
CStatic temp = new CStatic();
temp->Create(text ,style |SS_LEFT ,pos ,this ,m_iAutoControlID);bhw
-
I want to change the color of static control to white.As well as in the static controls the text also should be visible.
CStatic temp = new CStatic();
temp->Create(text ,style |SS_LEFT ,pos ,this ,m_iAutoControlID);bhw
See
WM_CTLCOLORSTATIC
and on the this message use ofSetTextColor()
for text color andSetBKColor()
for background color.
WhiteSky
-
See
WM_CTLCOLORSTATIC
and on the this message use ofSetTextColor()
for text color andSetBKColor()
for background color.
WhiteSky
This is a dynamically created control.is there any style or method to do that. bhw
-
This is a dynamically created control.is there any style or method to do that. bhw
I dont understand what you said can you more explain.
WhiteSky
-
I dont understand what you said can you more explain.
WhiteSky
WhiteSky wrote:
I dont understand what you said can you more explain.
The control is created at runtime rather than design time.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
-
WhiteSky wrote:
I dont understand what you said can you more explain.
The control is created at runtime rather than design time.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
No I want to know his question was about control or color.
WhiteSky
-
This is a dynamically created control.is there any style or method to do that. bhw
Hello Use WinProc or PreTranslateMessage to catch the message WM_CTLCOLORSTATIC and compare the control id with the id that you give to your static. And then is just the same as if you use the designer. Something like this:
BOOL CYourDialog::PreTranslateMessage(MSG* pMsg) { if(pMsg->message == WM_KEYDOWN && pMsg->wParam==VK_RETURN) { if(IsWindow(m_YourStatic.m_hWnd)) { if(pMsg->hwnd==m_YourStatic.m_hWnd) { DoSomething(); } } } }