Highlighting text in the view
I used the TextOut function of the CDC class to display lines of text in the view. These lines were inputted using a dialog and each new line was placed on a new line in the view also.
What I now want to do is to be able to click on any line of text in the view and have it highlighted. Given that I can click anywhere in a line how would I be able to have a rectangle defined to represent the line of text.
Wouldn't I have to have previously stored the CRECT object representing the dimensions of each line of text and if a particular point fell within the CRECT object for the particular line that would be a way of determining which area to highlight.
I know that I can use the WM_MOUSEDOWN WM_MOUSEUP handlers to retrieve the user's location in the view.
Am I on the right track? This solution seems a possibility but implementing it is just a little more difficult.
Thanks for any words of advice