|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);