Re: Adding plain text into CRichEditCtrl programmatically

Tech-Archive recommends: Speed Up your PC by fixing your registry



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

.



Relevant Pages

  • Re: Dynamic Dependant Downloads
    ... US format but some colleagues do! ... Private Sub Workbook_BeforeClose ... opening the selection is displayed as a text of the date serial number. ... To do this I would save the values in workbook defined ...
    (microsoft.public.excel.misc)
  • RE: Word 2007 Error - "This method or property is not available..."
    ... selection is locked for format changes." ... dlgRefreshSplash, String& sErrorMessage) in C:\25 ... locked for format changes.” Is telling me. ... BindingFlags invokeAttr, Binder binder, Objectparameters, CultureInfo ...
    (microsoft.public.office.developer.com.add_ins)
  • Re: VBA PasteSpecial AutoShape with text cant be inline?
    ... the With Selection was created after the Selection.PasteSpecial). ... characters in the text, and ran the macro. ... picture formatted as inline so that the user can place it ... graphic and format it as inline - just not in VBA. ...
    (microsoft.public.word.vba.general)
  • Quick selection of paragraph formats in Microsoft Word
    ... all of its releases of Microsoft Word is the quick selection of paragraph ... For real time documentations where format is important (e.g., ... through to make sure I am fully satisfied with my documentation and typing ...
    (microsoft.public.word.docmanagement)
  • VBA PasteSpecial AutoShape with text cant be inline?
    ... record a macro. ... 'Cut the selection to the clipboard for re-insertion later. ... picture formatted as inline so that the user can place it ... graphic and format it as inline - just not in VBA. ...
    (microsoft.public.word.vba.general)