Click here to Skip to main content
16,010,114 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: MFC Displaying Text Pin
Dennis Gourjii1-Sep-07 22:58
Dennis Gourjii1-Sep-07 22:58 
AnswerRe: MFC Displaying Text Pin
Mark Salsbery30-Aug-07 6:42
Mark Salsbery30-Aug-07 6:42 
GeneralRe: MFC Displaying Text Pin
barbarini30-Aug-07 6:48
barbarini30-Aug-07 6:48 
GeneralRe: MFC Displaying Text Pin
Mark Salsbery30-Aug-07 6:56
Mark Salsbery30-Aug-07 6:56 
GeneralRe: MFC Displaying Text Pin
barbarini30-Aug-07 8:42
barbarini30-Aug-07 8:42 
GeneralRe: MFC Displaying Text Pin
bob1697230-Aug-07 15:29
bob1697230-Aug-07 15:29 
GeneralRe: MFC Displaying Text Pin
Mark Salsbery30-Aug-07 20:33
Mark Salsbery30-Aug-07 20:33 
AnswerRe: MFC Displaying Text Pin
Vaclav_31-Aug-07 5:17
Vaclav_31-Aug-07 5:17 
I was little slow on the draw to offer solution but since I am working on similar stuff here is my 2 cents worth.
I ended up replacing CEditCtrl with CRichEditCtrl.
The color change is not too difficult. Here are my test functions straight from the MS documentation.

void CCC_RichEdit::OnReplaceAll( LPCTSTR lpszFind,
LPCTSTR lpszReplace, BOOL bCase, BOOL bWord )
{

int m_nNumReplaced;

CWaitCursor wait;
// no selection or different than what we are looking for
if (!FindText(lpszFind, bCase, bWord))
{
CRichEditView::OnTextNotFound( lpszFind );
return;
}

GetRichEditCtrl().HideSelection(TRUE, FALSE);
m_nNumReplaced = 0;
do
{
// change text color
OnCharUnderline();
//GetRichEditCtrl().SetBackgroundColor(FALSE, RGB(155,0, 0));

GetRichEditCtrl().ReplaceSel(lpszReplace);
m_nNumReplaced++; // Record the number of replacements

} while (FindTextSimple(lpszFind));
GetRichEditCtrl().HideSelection(FALSE, FALSE);




}


void CCC_RichEdit::OnCharUnderline ()
{
CHARFORMAT cf;
cf = GetCharFormatSelection ();

if (!(cf.dwMask & CFM_UNDERLINE) || !(cf.dwEffects & CFE_UNDERLINE))
{
cf.dwEffects = CFE_UNDERLINE;

}

else
cf.dwEffects = 0;

// change text color
cf.dwMask = CFM_UNDERLINE |CFM_COLOR ;
cf.crTextColor = RGB(255,0, 0);

SetCharFormat (cf);
}




This code does not change background color, work in progress.

Few observations - it seem that CFE_AUTOCOLOR is not set as default and does not have to be removed to make color changes.

Right now I cannot make "regular" pop up to work.

My question to the group - where is the documentation stating that double click on text selects it? Obviously I need to "override" that pretty useless action.


Thanks guys. Very helpful discussion.

QuestionSchell Pin
ellllllllie30-Aug-07 6:09
ellllllllie30-Aug-07 6:09 
AnswerRe: Schell Pin
led mike30-Aug-07 7:57
led mike30-Aug-07 7:57 
AnswerRe: Schell Pin
Russell'30-Aug-07 8:08
Russell'30-Aug-07 8:08 
GeneralRe: Schell Pin
Perspx30-Aug-07 9:25
Perspx30-Aug-07 9:25 
GeneralRe: Schell Pin
Russell'30-Aug-07 9:52
Russell'30-Aug-07 9:52 
QuestionLinking and recompiling a DLL Pin
Fernando A. Gomez F.30-Aug-07 6:08
Fernando A. Gomez F.30-Aug-07 6:08 
AnswerRe: Linking and recompiling a DLL Pin
Dennis Gourjii30-Aug-07 6:34
Dennis Gourjii30-Aug-07 6:34 
AnswerRe: Linking and recompiling a DLL Pin
James R. Twine30-Aug-07 7:15
James R. Twine30-Aug-07 7:15 
QuestionDrawing lines... Pin
omnimny30-Aug-07 4:43
omnimny30-Aug-07 4:43 
JokeRe: Drawing lines... Pin
Maximilien30-Aug-07 5:06
Maximilien30-Aug-07 5:06 
GeneralRe: Drawing lines... Pin
omnimny31-Aug-07 8:12
omnimny31-Aug-07 8:12 
AnswerRe: Drawing lines... Pin
Russell'30-Aug-07 7:52
Russell'30-Aug-07 7:52 
GeneralRe: Drawing lines... Pin
omnimny31-Aug-07 8:54
omnimny31-Aug-07 8:54 
GeneralRe: Drawing lines... Pin
Russell'31-Aug-07 22:07
Russell'31-Aug-07 22:07 
GeneralRe: Drawing lines... Pin
omnimny14-Sep-07 3:26
omnimny14-Sep-07 3:26 
GeneralRe: Drawing lines... Pin
Russell'14-Sep-07 3:34
Russell'14-Sep-07 3:34 
QuestionImage Zoom (Scaling?) with GDI+ Pin
TheShihan30-Aug-07 3:29
TheShihan30-Aug-07 3:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.