Solved

RichEdit Highlight Line

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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Suggested Solutions

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 shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
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…

713 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