Re: Find The Text :-)
- From: "Larry Serflaten" <serflaten@xxxxxxxxxxxxxx>
- Date: Sun, 22 Jul 2007 14:54:21 -0500
"Ivar" <ivar.ekstromer000@xxxxxxxxxxxx> wrote
The question is how to find the left and top (in pixels) of the text that is
selected in the cboFind combo box with in the serch text.
Any ideas?
Maintain the text rectangle as a series of rectangles each large enough
to hold one line of text. By using the calculation option of the DrawText
API you can determine how much will fit on one line by watching what
happens to the bottom of your rectangles. If they get expanded, then you
have too much text for one line and need to shorten the amount of text
printed. You would break up your string accordingly as you print line
by line.
When you get to the line that has your desired word, calculate the size
needed to print to and including that word. That gives you the right edge. Then calculate the size needed to print up to (not
including) the desired
word, that gives you the left edge. Now print the entire line and highlight
(or whatever) the area between the right and left edges.
Just an idea....
LFS
.
- References:
- Find The Text :-)
- From: Ivar
- Find The Text :-)
- Prev by Date: Re: User control misunderstanding...
- Next by Date: Re: Track "WINWORD.EXE" VB6
- Previous by thread: Find The Text :-)
- Next by thread: Re: Find The Text :-)
- Index(es):