CRichEditCtrl halt any visual updates for a sec !!
-
Hi, I am using a CRichEditCtrl with an almost black background and white text. The problem is that when I want to print the text, the printer tries to simulate the original screen colors. In my case, I would like to print with standard black text & white background. What i am doing now, is that : Before that print start, I change the control with the standard colors and after the end of the printing I revert to the original screen colors. The code seems like the following :
//hide selection HideSelection(TRUE,FALSE); //to view this correctly in MS Word or to any other word processor //You should change the colors. Do the background white and the text black //Disable the ENM\_CHANGE events manually. We dont want to make the handler think that where was //indeed an event. SetEventMask(~ENM\_CHANGE & GetEventMask()); int CurChar=CharFromPos(currentpos); long len=GetTextLength(); SetSel(0 , len); SetBackgroundColor(FALSE, RGB(255,255, 255)); SetColor(RGB(0,0,0)); //-------------------------------------------------------- //**\-------> Printing code here** <-------------------- //-------------------------------------------------------- SetSel(0 , len); SetBackgroundColor(FALSE, RGB(61,61, 56)); SetColor(RGB(255,255,255)); SetSel(CurChar,CurChar); //Re-enable the ENM\_CHANGE events manually. SetEventMask(ENM\_CHANGE | GetEventMask()); //reenable selection HideSelection(FALSE,FALSE);
The above code creates a flicker, especially if the pages to be printed are many. Is there any solution, like to halt visual updating of the CRichEditCtrl control for a specific period of time to avoid flicker ?
sdancer75
-
Hi, I am using a CRichEditCtrl with an almost black background and white text. The problem is that when I want to print the text, the printer tries to simulate the original screen colors. In my case, I would like to print with standard black text & white background. What i am doing now, is that : Before that print start, I change the control with the standard colors and after the end of the printing I revert to the original screen colors. The code seems like the following :
//hide selection HideSelection(TRUE,FALSE); //to view this correctly in MS Word or to any other word processor //You should change the colors. Do the background white and the text black //Disable the ENM\_CHANGE events manually. We dont want to make the handler think that where was //indeed an event. SetEventMask(~ENM\_CHANGE & GetEventMask()); int CurChar=CharFromPos(currentpos); long len=GetTextLength(); SetSel(0 , len); SetBackgroundColor(FALSE, RGB(255,255, 255)); SetColor(RGB(0,0,0)); //-------------------------------------------------------- //**\-------> Printing code here** <-------------------- //-------------------------------------------------------- SetSel(0 , len); SetBackgroundColor(FALSE, RGB(61,61, 56)); SetColor(RGB(255,255,255)); SetSel(CurChar,CurChar); //Re-enable the ENM\_CHANGE events manually. SetEventMask(ENM\_CHANGE | GetEventMask()); //reenable selection HideSelection(FALSE,FALSE);
The above code creates a flicker, especially if the pages to be printed are many. Is there any solution, like to halt visual updating of the CRichEditCtrl control for a specific period of time to avoid flicker ?
sdancer75
I'm not quite sure if this helps, but you may give it a try: Call
SetRedraw(0)
just afterHideSelection()
and re-enable it before showing the selection. This will prevent the screen from being updated with the control content while printing. -
Hi, I am using a CRichEditCtrl with an almost black background and white text. The problem is that when I want to print the text, the printer tries to simulate the original screen colors. In my case, I would like to print with standard black text & white background. What i am doing now, is that : Before that print start, I change the control with the standard colors and after the end of the printing I revert to the original screen colors. The code seems like the following :
//hide selection HideSelection(TRUE,FALSE); //to view this correctly in MS Word or to any other word processor //You should change the colors. Do the background white and the text black //Disable the ENM\_CHANGE events manually. We dont want to make the handler think that where was //indeed an event. SetEventMask(~ENM\_CHANGE & GetEventMask()); int CurChar=CharFromPos(currentpos); long len=GetTextLength(); SetSel(0 , len); SetBackgroundColor(FALSE, RGB(255,255, 255)); SetColor(RGB(0,0,0)); //-------------------------------------------------------- //**\-------> Printing code here** <-------------------- //-------------------------------------------------------- SetSel(0 , len); SetBackgroundColor(FALSE, RGB(61,61, 56)); SetColor(RGB(255,255,255)); SetSel(CurChar,CurChar); //Re-enable the ENM\_CHANGE events manually. SetEventMask(ENM\_CHANGE | GetEventMask()); //reenable selection HideSelection(FALSE,FALSE);
The above code creates a flicker, especially if the pages to be printed are many. Is there any solution, like to halt visual updating of the CRichEditCtrl control for a specific period of time to avoid flicker ?
sdancer75