News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Line spacing in an edit control

Started by jimg, June 24, 2017, 03:36:12 PM

Previous topic - Next topic

jimg

Anyone know how to compute how many pixels an edit or richedit puts between lines?   For the program I'm working on, I want to populate the control with only the exact number of lines that will fit in the visible area on screen.   I can get the height of the font, and the height of the control, and doing so, I can see from 2 to 4 pixels between lines used depending upon the font and size, but I can't find any documentation to pin down how it is actually determined.

I don't want the control scrolling, so no scroll bars.  But if too many lines are present, the user can move the caret right off the visible part of the control with the down arrow key.   I've tried every api I can find with no success.  The lines are probably a simple percentage of the font height or something, I'd just like to know what's actually used so I can emulate it.

jimg

It seems like this happens every time :redface:

I swear I tried twenty things today without success.  Right after posting the above, I found EM_POSFROMCHAR.
Write two lines to the control of know length.  Send the message for character one and one of the characters on the second line and subtract.
After playing with paraformats and many other awful things, this is pretty simple.