Display multi line colors in Rich edit control using VC++
-
I have a static control(derived from CStatic) and rich edit controls and it contains two lines. I want to set the color of the first line to blue and the second line to red. Currently I am using the CDialog::OnCtlColor and using the SetTextColor function to set the color. However it sets the color for the whole static control i.e. both the lines. Can someone help? knarasimharao
-
I have a static control(derived from CStatic) and rich edit controls and it contains two lines. I want to set the color of the first line to blue and the second line to red. Currently I am using the CDialog::OnCtlColor and using the SetTextColor function to set the color. However it sets the color for the whole static control i.e. both the lines. Can someone help? knarasimharao
Just an out line of procedure. customizee as you like:) HWND hRichEdit = NULL; CHARFORMAT* cf = NULL; hRichEdit = (HWND)GetDlgItem (IDC_RICHEDIT); CHARRANGE cr; cr.cpMin = 0; // set strating char position cr.cpMax = -1;// end char pos SendMessage(hRichEdit, EM_EXSETSEL, 0, (LPARAM)&cr); cf = new CHARFORMAT; cf->cbSize = sizeof(CHARFORMAT); cf->dwMask = CFM_COLOR |CFM_BOLD|CFM_FACE|CFM_SIZE|CFM_ITALIC; cf->dwEffects = CFE_BOLD; cf->crTextColor = RGB(255,0,0); cf->yHeight = 160; strcpy ( cf->szFaceName, "Ariel"); SendMessage( (HWND) hRichEdit, SCF_SELECTION, (WPARAM) SCF_ALL, (LPARAM) cf); :) All the best AnilFirst@gmail.com
-
Just an out line of procedure. customizee as you like:) HWND hRichEdit = NULL; CHARFORMAT* cf = NULL; hRichEdit = (HWND)GetDlgItem (IDC_RICHEDIT); CHARRANGE cr; cr.cpMin = 0; // set strating char position cr.cpMax = -1;// end char pos SendMessage(hRichEdit, EM_EXSETSEL, 0, (LPARAM)&cr); cf = new CHARFORMAT; cf->cbSize = sizeof(CHARFORMAT); cf->dwMask = CFM_COLOR |CFM_BOLD|CFM_FACE|CFM_SIZE|CFM_ITALIC; cf->dwEffects = CFE_BOLD; cf->crTextColor = RGB(255,0,0); cf->yHeight = 160; strcpy ( cf->szFaceName, "Ariel"); SendMessage( (HWND) hRichEdit, SCF_SELECTION, (WPARAM) SCF_ALL, (LPARAM) cf); :) All the best AnilFirst@gmail.com
anilFirst wrote:
CHARFORMAT* cf = NULL;
Won't this work... CHARFORMAT cf;
Love Forgives--Love Gives--Jesus is Love :)
--Owner Drawn --Nothing special --Defeat is temporary but surrender is permanent --Never say quits --Jesus is Lord
-
anilFirst wrote:
CHARFORMAT* cf = NULL;
Won't this work... CHARFORMAT cf;
Love Forgives--Love Gives--Jesus is Love :)
--Owner Drawn --Nothing special --Defeat is temporary but surrender is permanent --Never say quits --Jesus is Lord
>>Won't this work... >>CHARFORMAT cf; It will....Carry on AnilFirst@gmail.com