Changing word wrap mode


If you are using a CRichEditView derivative, you have built in support for three different word wrap modes. The three modes are:

WrapNone Indicates no automatic word wrapping
WrapToWindow Indicates word wrapping based on the width of the window
WrapToTargetDevice Indicates word wrapping based on the characteristics of the target device

To change the mode you have to assign one of these values to the m_nWordWrap member and then call the WrapChanged() member function. If you don't call the WrapChanged() function the control window is not updated.

	// Code to use with CRichEditView
	// Turn word wrap on
	m_nWordWrap = WrapToWindow;
	WrapChanged();

If you are using the CRichEditCtrl class or a class derived from it, you have neither the m_nWordWrap member variable nor the WrapChanged() member functions. In this case you have to use the SetTargetDevice() function. Although the SetTargetDevice() function is documented, the first two usage shown below isn't, but it is used by MFC itself.
	// Code to use with CRichEditCtrl
	// To turn word wrap off
	SetTargetDevice(NULL, 1);


	// To turn word wrap on - based on window width
	SetTargetDevice(NULL, 0);


	// To turn word wrap on - based on target device (e.g. printer)
	// m_dcTarget is the device context, m_lineWidth is the line width 
	SetTargetDevice(m_dcTarget, m_lineWidth);



Comments

  • Det er mange alternativer for de som kjøper denne typen hodetelefoner.

    Posted by mantouhmmm on 06/04/2013 07:17pm

    [url=http://www.beatshodetelefoner.webstarts.com/]beats by dre norge[/url] Her er en syv trinns formel for å lage musikk: Trinn 1: Velg materiale til sangen din. Hvis du bruker samples, kompilere alle lydene som du ønsker i din sang ordningen. Du trenger basstrommer, perkusjon, basslinjer, melodiske leder, vokal, pads, og lyden effects.Step2: Song struktur. Forstå hva hver instrumenter rolle er i sangen din vil gi deg en bedre forståelse hva hvert instrument er ment å do.Step3: Få musikken ned. Dette er prosessen med å samle inn dine sang uten redigering. Få en kladd av hva sangen kan høres ut som. Begynn med Beats By Dre Solo først for å få rytmen i sangen går. Deretter ta andre virkemidler i en freestyle måte bare for å få en idé om hva den endelige lyden vil bli. [url=http://www.drebeatsnorge.qsite.dk/]beats by dre norge[/url] Musikk og filmer er også et godt valg for mødre som er interessert i det. Den aller beste av de og CDer kan passe inn i hennes gave kurv. Klassiske samlinger og også sanger annonse filmer fra barndommen kan faktisk gjøre henne oppriktig glad og gjøre henne gå tilbake igjen til tidligere tider. Du kan også bestemme sanger eller filmer som du har et minne med henne. Eller bare, gave henne med et utvalg av hennes favoritt movies.Chocolates og søtsaker er også et godt valg. For den saks skyld, kan du fylle gave kurv med hennes favoritt måltider stuffs eller en ting som hun ofte ønsket å ha og kunne aldri ha det. For mødre som liker hagearbeid, ikke nøl. Gå for de fineste frø eller gå for stiklinger av vakre blomster eller grønnsaker som gjør hennes hage fantastisk. [url=http://www.beatsdrenorge.webgarden.com/]Monster Beats norge[/url] Designet for imponerende lyd, K551 50 mm drivere (nesten 2 inches, for de som er på keiserlige målinger) som støttes av Engineering ekte AKG bilde. Disse referansen førsteklasses hodetelefonene er utformet for å gi et fullt realistisk og naturtro gjengivelse av livet, og de gode sjåfører er grunnlaget for gjennomføring av lyden. Fast Image Engineering er utformet for å gi klarhet, dybde og avstand i musikk lytting. Lukkede tilbake beatsbre1 SJD gir støyisolering å holde uønsket støy fra mens lær innpakket, polstrede øreklokker hindre lyd lekker ut. AKG design er ikke bare verdifullt for ørene, men øynene samt lette og portable hodetelefoner er laget i klassisk stil med tidløs vinkler Andre funksjoner inkluderer.

    Reply
  • Nike Display Max 1 FB release, cause a strong color texture, the new shoes

    Posted by Geozyoceada on 04/25/2013 03:25am

    In the summer in a goblet guts the cool sprite seems to be a good preferred, but if the sprite "feet"? Longing also fork out you a set off, accompany a slaking nourishment! This summer, Nike and Sprite [url=http://markwarren.org.uk/property-waet.cfm]nike air max 90[/url] and his sneakers to a commingling of enduring snow spread of callow, drained and downcast color scheme in the undying Nike Arrogance Max 1 shoes reveal a drinks chill scent.[url=http://fossilsdirect.co.uk/glossarey.cfm]nike huarache free[/url] Summer is the yet to select a moral shoe, shoes should be a acceptable choice. Qualifying series Nike Freshen Max HomeTurf megalopolis recently definitely comes up, this series in the masterpiece Melody Max shoes to London, Paris and Milan the three paid glorification to the iconic megalopolis of Europe, combined with the characteristics of the three cities, Sense Max 1 HYP,Tell Max 90 HYP,Show Max 1 and shoes such as Make public Max 95, combined [url=http://markwarren.org.uk/goodbuy.cfm]nike free uk[/url] with the Hyperfuse, as marvellously as a variety of materials, such as suede, Whether you after functioning or retro-everything.

    Reply
  • Nike Current Max 1 FB publicity, have on the agenda c trick a eager color character, the new shoes

    Posted by Geozyoceada on 04/19/2013 11:29pm

    In the summer in a tumbler interior the chilling sprite seems to be a good fitting, but if the sprite "feet"? Will also give you a frisk, accompany a sustenance! This summer, Nike and Sprite [url=http://markwarren.org.uk/goodbuy.cfm]nike free run uk[/url] and his sneakers to a graduate of enduring snow spread of callow, drained and dejected color system in the definitive Nike Feeling Max 1 shoes reveal a refreshing cool scent.[url=http://fossilsdirect.co.uk/glossarey.cfm]nike huarache free[/url] Summer is the yet to select a cleanly shoe, shoes should be a creditable choice. Qualifying series Nike Freshen Max HomeTurf metropolis recently finally comes up, this series in the classic Breath Max shoes to London, Paris and Milan the three paid encomium to the iconic see of Europe, combined with the characteristics of the three cities, Air Max 1 HYP,Make public Max 90 HYP,Air Max 1 and shoes such as Quality Max 95, combined [url=http://markwarren.org.uk/property-waet.cfm]nike air max 90[/url] with the Hyperfuse, as kindly as a collection of materials, such as suede, Whether you crave functioning or retro-everything.

    Reply
  • YES! Can make it wrap in windows and dialog boxes now, no MFC

    Posted by Legacy on 12/28/2003 12:00am

    Originally posted by: Ben

    THANK YOU! I am not using MFC and I have a floating resizable window with a rich text edit control it. I simply could not figure out how to make it wrap words until I read this section. The documentation did not suggest anything obvious. Did not think the target device was the right option to use. Anyway, this turns on word wrap on and should work in a dialog window too:

    SendMessage(hwndRichEditWindow, EM_SETTARGETDEVICE, 0, 0);

    or

    SendMessage(GetDlgItem(hDlg, IDC_RichEdit1), EM_SETTARGETDEVICE, 0, 0);

    Oh, you may need this include to do this:

    #include <richedit.h>

    Reply
  • To make CRichEditCtrl wrap correctly in a dialog

    Posted by Legacy on 06/10/2002 12:00am

    Originally posted by: Jon Schneider

    1.) Map a CRichEditCtrl variable to your control.
    
    2.) Call SetTargetDevice(NULL,0) as the article describes.
    3.) Do not forget to change the controls styles! You must set the control to be "multiline" and (most likely you will prefer) "want return" or the above call will not result in the line wrapping you desire!

    Reply
  • How to make the CRichEditCtrl Wrap correctly in chinese characters

    Posted by Legacy on 01/12/2000 12:00am

    Originally posted by: Philip

    I would like to use it to display chinese big 5 and GB code.
    Even, I set the character format to chinese character, it still cannot wrap correctly. What shall I do?

    Reply
  • CRichEditCtrl wrap

    Posted by Legacy on 01/06/2000 12:00am

    Originally posted by: Paul Saccasyn

    I would like to have m_lineWidth expressed in number of characters of my CRichEditCtrl.
    How do I know the width of a character of the currently used font ?
    In which unit is m_lineWidth expressed ?

    Reply
  • Wrapping and Paragraph Format Conflict

    Posted by Legacy on 04/06/1999 12:00am

    Originally posted by: Rizwan Zubairy

    How to change the wrapping in rich edit control when I use right align paragraph formatting?

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Live Event Date: October 29, 2014 @ 11:00 a.m. ET / 8:00 a.m. PT Are you interested in building a cognitive application using the power of IBM Watson? Need a platform that provides speed and ease for rapidly deploying this application? Join Chris Madison, Watson Solution Architect, as he walks through the process of building a Watson powered application on IBM Bluemix. Chris will talk about the new Watson Services just released on IBM bluemix, but more importantly he will do a step by step cognitive …

  • In support of their business continuity and disaster recovery plans, many midsized companies endeavor to avoid putting all their eggs in one basket. Understanding the critical role of last-mile connectivity and always available Internet access for their enterprises, savvy firms utilize redundant connections from multiple service providers. Despite the good intentions, their Internet connectivity risk may still be in a single basket. That is because internet service providers (ISPs) and competitive local …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds