Dialog Application-Adding Color to Display Data
-
Hi, I have a Dialog application. In some cases I am displaying data in the main dialog by accessing data in an array: str2.Format("%02d\t, m_Parse.mChannel[i].m_SV); str+=str2; SetDlgItemText(IDC_SAT, str); etc. etc. What I want to do is to have some of the data displayed in different colors other than black. How can I set the color of some data before displaying it? Can someone help me out? :) Jerry
-
Hi, I have a Dialog application. In some cases I am displaying data in the main dialog by accessing data in an array: str2.Format("%02d\t, m_Parse.mChannel[i].m_SV); str+=str2; SetDlgItemText(IDC_SAT, str); etc. etc. What I want to do is to have some of the data displayed in different colors other than black. How can I set the color of some data before displaying it? Can someone help me out? :) Jerry
I think the only control that would allow you to mix colors in the text would be a rich edit control. You could use read-only rich edit controls. If that's way overkill for just colored text, you could render the text yourself in response to the WM_PAINT message using perhaps some/all of these functions: SelectObject() to select a NULL brush (NULL_BRUSH) into the DC or possibly another font as well SetTextColor() SetROP2() to set the foreground mixing mode (to R2_COPYPEN, for example) SetBkMode() to set the background mixing mode (to TRANSPARENT, for example) DrawText() to draw the text Just two possibilities Mark
-
Hi, I have a Dialog application. In some cases I am displaying data in the main dialog by accessing data in an array: str2.Format("%02d\t, m_Parse.mChannel[i].m_SV); str+=str2; SetDlgItemText(IDC_SAT, str); etc. etc. What I want to do is to have some of the data displayed in different colors other than black. How can I set the color of some data before displaying it? Can someone help me out? :) Jerry
Whats your control?
WhiteSky
-
Whats your control?
WhiteSky
A text control. Jerry
-
A text control. Jerry
if your control is Edit see
WM_CTLCOLOREDIT
WhiteSky
-
if your control is Edit see
WM_CTLCOLOREDIT
WhiteSky
Ok I will take a look at that...thanks, have a good day. :) Jerry
-
Ok I will take a look at that...thanks, have a good day. :) Jerry
And see MSDN
WM_CTLCOLOR
notification.It has an example and also you can see another CTLCOLOR_*:)
WhiteSky