Re: Adding plain text into CRichEditCtrl programmatically
- From: chhenning@xxxxxxxxx
- Date: 6 Dec 2006 12:42:32 -0800
Hi Joseph, thanks for the hint. However, I don't really understand how
to change a format of a selection. I tried SetSelectionCharFormat but
nothing happens. Also, I don't get why using ReplaceSel(). I can set my
text using SetWindowText() and then step through it and change the
format appropriately. Right?
Here is some sample code:
void CReadIn2View::OnInitialUpdate()
{
CRichEditView::OnInitialUpdate();
// Set the printing margins (720 twips = 1/2 inch)
SetMargins(CRect(720, 720, 720, 720));
SetWindowText( "Frist Second" );
CRichEditCtrl& oDisplayRichEditCtrl = GetRichEditCtrl();
oDisplayRichEditCtrl.SetSel( 0, 5 );
CHARFORMAT cf;
::ZeroMemory( &cf, sizeof( CHARFORMAT ));
cf.dwMask = CFM_STRIKEOUT|CFM_BOLD;
cf.dwEffects = CFE_BOLD;
if( !oDisplayRichEditCtrl.SetSelectionCharFormat( cf ) ) assert(
false );
}
Nothing happens. Only "First" is being selected but neither bold or
stroke-out.
Do you know what is wrong?
Christian
.
- Follow-Ups:
- Re: Adding plain text into CRichEditCtrl programmatically
- From: Joseph M . Newcomer
- Re: Adding plain text into CRichEditCtrl programmatically
- References:
- Adding plain text into CRichEditCtrl programmatically
- From: chhenning
- Re: Adding plain text into CRichEditCtrl programmatically
- From: Joseph M . Newcomer
- Adding plain text into CRichEditCtrl programmatically
- Prev by Date: Re: Internationalizing an app
- Next by Date: Re: How to LPCTSTR Convert to char *
- Previous by thread: Re: Adding plain text into CRichEditCtrl programmatically
- Next by thread: Re: Adding plain text into CRichEditCtrl programmatically
- Index(es):
Relevant Pages
|