Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

RichEdit Highlight Line

Posted on 1998-07-14
4
Medium Priority
?
524 Views
Last Modified: 2013-12-03
In a Richtext edit control there are methods to select a line and cause the backgound to go black and format controls to colorize the text or set the background color for the entire control but there are no methods or format controls to highlight a single line (i.e. cause the background color to change as in Word for windows rich text mode which allows line hightlighting)
How can a single line of text be highlighted in a richedit control?
0
Comment
Question by:hrybyk
4 Comments
 
LVL 8

Expert Comment

by:trestan
ID: 1410073
Pls try the online help at:
Platform, SDK, and DDK Documentation -> Platform SDK -> User Interface Services -> User Input -> Mouse Input -> Selecting a Line of Text
0
 

Author Comment

by:hrybyk
ID: 1410074
How do you highlight a line independent of the current selected text?
0
 

Expert Comment

by:NancyO
ID: 1410075
I'm a little confused on what you are trying to do.  Are you saying that you want to be able to hilight two sections of the text at a time, so that you can hilight a particular line of text without destroying any selections that already exist?
0
 
LVL 1

Accepted Solution

by:
timop earned 400 total points
ID: 1410076
Code to highlight a single line:

CRichEditCtrl re;


// nLineNumber - line number , zero-based
re.SetSel( re.LineIndex( nLineNumber ),  re.LineIndex( nLineNumber + 1 ) );

0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a technique for converting RTF (Rich Text Format) data to HTML and provides C++ source that does it all in just a few lines of code. Although RTF is coming to be considered a "legacy" format, it is still in common use... po…
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question