Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Q: Need pixel start/end coordinates of lines in text control

0 views
Skip to first unread message

rou...@4gl.enet.dec.com

unread,
Jun 27, 1994, 7:00:02 PM6/27/94
to

I'm working on a project using multi-line text controls which involves
being able to draw graphics next to the edge of the text control which
should line up with particular lines in the control. The method I'm
currently using works OK for early parts of the text in the control, but
for later text, the graphics seems to get 'off kilter'.

The method I'm using to paint the graphics is something like:

- line number of desired line to display next to is known
- get the line number of the first visible line in the
text control
- multiply the difference between the two lines by the
font height (metrics.tmHeight)

Other than some finageling for the fact that edit controls are zero based,
and a fudge factor of 1 pixel for each line, the above seems to basically
work. Except, as I said, the graphics get out of sync for later text in
the edit control.

I've tried applying metrics.tmExternalLeading, but debugging shows that its
always zero. Using a fixed system font doesn't help either.

I'd appreciate some ideas! I scanned subjects for the previous month's
worth of articles and didn't see anything apropos. Although someone did
mention that the text metrics structure used with GetDC() was always set
to default values, not necessarily the real values.

So how can I change my method so the graphics are always in sync? Or
perhaps more specific, how do I determine the height of a multiline
text edit control line?

Thanks!
--
Kevin Routley
-------------
This article represents my opinions and is not a formal statement from
Digital Equipment Corporation.

0 new messages