Solved

RichEdit Highlight Line

Posted on 1998-07-14
4
491 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 200 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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This article shows how to make a Windows 7 gadget that accepts files dropped from the Windows Explorer.  It also illustrates how to give your gadget a non-rectangular shape and how to add some nifty visual effects to text displayed in a your gadget.…
This article describes how to add a user-defined command button to the Windows 7 Explorer toolbar.  In the previous article (http://www.experts-exchange.com/A_2172.html), we saw how to put the Delete button back there where it belongs.  "Delete" is …
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 video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

743 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now