Hi,
I was wondering is the re a way to center Multilines with DrawText Vertically?
It seems that DT_VCENTER only works with single lines :(
szText db 'Text Line1',13,10
db 'Text Line2',13,10
db 'Text Line2', 0
This wont work
invoke DrawText, ps.hdc, addr szText,-1, addr rcClient,
DT_VCENTER or DT_CENTER or DT_NOPREFIX
No. You need two invokes, the first with DT_CALCRECT.
@ jj2007
I don't understand what you mean ?
Have different data values ?
Like
szText db 'Text Line1',13,10
szText 1 db 'Text Line2',13,10
szText 2 db 'Text Line2', 0
I have tried this ...does not seem right?
invoke DrawText, ps.hdc, addr szHello,-1, addr rcClient,
DT_CALCRECT or DT_VCENTER
invoke DrawText, ps.hdc, addr szHello,-1, addr rcClient,
DT_CENTER
"If the function succeeds, the return value is the height of the text."
- invoke DrawText, ... DT_CALCRECT
- mov edx, heightofbox
- sub edx, eax
- sar edx, 1
- add rc.top, edx
- invoke DrawText, ... DT_whatever
@jj2007
Nice!!! :t
That worked Great ..... The " heightofbox" is actually pixels from the top to go down
I will add a little Demo in case some one else runs into this
Thank You Again jj2007 ! :t
Here is that example in case some one else runs into this :biggrin: