I'm tring to size controls based upon the height of a text line... for floating controls & controls that operate only on one line of text. I've got a method that works but I'll bet there's a better one out there. seeing that this is rather convoluted. btw: getting the height from text metrics won't work because it only returns the ascending & descending height & not the space between lines... but then again, i'm asking

    editTestMsg DB 13,10,"H",0

.......later on.....

        invoke SendMessage, hEdit0, WM_SETTEXT, NULL, ADDR editTestMsg
        .IF editVer == 3
            invoke SendMessage, hEdit0, EM_POSFROMCHAR, ADDR cPoint, 2
            invoke SendMessage, hEdit0, EM_POSFROMCHAR, 2, NULL
            shr eax, 16
            mov cPoint.y, eax
        mov eax, cPoint.y
        mov buttonHeight, eax
        invoke SendMessage, hEdit0, WM_SETTEXT, NULL, NULL
this has been a solid method for the fonts & points I tested but that was relatively light testing. rafe PS: I only tried this on a rich edit control & not the vanilla edit control b/c I didn't find the correct message to send to the vanilla edit... if there is one This message was edited by rafe, on 7/5/2001 11:46:21 AM
Posted on 2001-07-05 11:42:00 by rafe
rafe, TEXTMETRIC has this info.
tmExternalLeading Specifies the amount of extra leading (space) that the application adds between rows. Since this area is outside the font, it contains no marks and is not altered by text output calls in either OPAQUE or TRANSPARENT mode. The designer may set this member to zero.
Posted on 2001-07-06 01:21:00 by sjhenry
rafe, Try using GetTextExtentPoint32, like this


mychar   'X'
mysizex  dd 0
mysizey  dd 0


invoke GetTextExtentPoint32,hdc,addr mychar,1,addr mysizex

Now mysize x is the width, and mysizey is the height. Works fine for most of my applications, and is simple to use. umbongo
Posted on 2001-07-06 05:09:00 by umbongo
thanks to both Jones & umbongo I'll get into to both tonight when I get to the asm (non-work related) coding computer. but saddly the modem is broken at home so I can't read then try in one swell foop :( it seems that I need to learn to read again ;) Didn't see the text metric external leading &, not that it matters given that I've gotten TWO better solutions, it eventually dawned on me that EM_POSFROMCHAR is for a standard message box. i think i'll go back to posting on the newbie forum for a while... i hope i'm at least providing some comic relief:D This message was edited by rafe, on 7/6/2001 1:07:34 PM
Posted on 2001-07-06 12:53:00 by rafe