15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


CRichEditCtrl SetSel Color

John Howard Robertson -- jrobert@howard-ind.com
Thursday, January 09, 1997

Environment:  VC++4.2b; Win95

Greetings:

I am using a CRichEditCtrl to display a text file and perform text =
modifications without user input.=20
Therefore, my control will be read only. =20

As my program executes, the text is traversed, and I will change the =
text color.=20

So, here's my problem:  when I use the SetSel function, the selected =
text has its background highlighted to grey.  I would like to find a way =
to either disable or change the color of the highlighting. =20

Any and all suggestions are appreciated.

Thanks,
John Howard Robertson
jrobert@howard-ind.com




JCS -- JCS@ficsgrp.com
Monday, January 13, 1997

Hi John,

Try to modify this code I made to color a full line in a CRichEditView.

void CMyRichEditView::ColorLine(int linenr, COLORREF color)
{
 char szLine[1024];
 int nSta, nLen;
 CHARFORMAT cfRich;

 nLen = GetRichEditCtrl().GetLine(linenr - 1, szLine, sizeof(szLine) -   
1);

 nSta = GetRichEditCtrl().LineIndex(linenr - 1);

 // Select invisibilly the specified line
 GetRichEditCtrl().HideSelection(TRUE,FALSE);
 GetRichEditCtrl().SetSel( nSta, nSta + nLen );

 // Change the color format of the selected line
 GetRichEditCtrl().GetSelectionCharFormat(cfRich);
    

 cfRich.dwMask |= CFM_COLOR;

 cfRich.dwEffects &= ~CFE_AUTOCOLOR;
 cfRich.crTextColor = color;

 GetRichEditCtrl().SetSelectionCharFormat(cfRich);

 // Select the beginning of the line
 GetRichEditCtrl().SetSel( nSta, nSta);
 GetRichEditCtrl().HideSelection(FALSE,FALSE);
 GetRichEditCtrl().SetSel( nSta, nSta);
}

Jan Castermans,
FICS Group, Belgium
 ----------
From:  John Howard Robertson
Sent:  donderdag 9 januari 1997 17:12
To:  'mfc-l'
Subject:  CRichEditCtrl SetSel Color

Environment:  VC++4.2b; Win95

Greetings:

I am using a CRichEditCtrl to display a text file and perform text =
modifications without user input.=20
Therefore, my control will be read only. =20

As my program executes, the text is traversed, and I will change the =
text color.=20

So, here's my problem:  when I use the SetSel function, the selected =
text has its background highlighted to grey.  I would like to find a way   
=
to either disable or change the color of the highlighting. =20

Any and all suggestions are appreciated.

Thanks,
John Howard Robertson
jrobert@howard-ind.com




| Вернуться в корень Архива |