| |
|
|
|
Source watts on the 15.07.2007 from the MMJ-Quellcodesammlung (Dietmar horn) in The Babyklappe on XProfan.Com stored:
Textbreite and Texthöhe with the spending of Strings to determine (in Pixel)
Def GetTextExtentPoint32(4) !GDI32,GetTextExtentPoint32A
Def GetDC(1) !USER32,GetDC
Def ReleaseDC(2) !USER32,ReleaseDC
cls
UseFont Arial,48,0,0,0,0;0
Proc GetTextExtent
Parameters _t$,_w%
declare _size#,_text#,_result&,_hdc&
dim _text#,Len(_t $) + 1
dim _size#,8
String _text#,0 = _t$
_hdc& = GetDC(GetActiveWindow())
GetTextExtentPoint32(_hdc&,_text#,Len(_t $),_size#)
_result& = Long(_size#,4)
Case _w% : _result& = Long(_size#,0)
ReleaseDC(GetActiveWindow(),_hdc&)
dispose _text#
dispose _size#
return _result&
ENDPROC
Proc GetStringHeight
Parameters _t$
GetTextExtent _t$,0
Return &(0)
ENDPROC
Proc GetStringWidth
Parameters _t$
GetTextExtent _t$,1
Return &(0)
ENDPROC
declare StringBreite&,StringHoehe&,Text$
text$ = good day, rather computer!
GetTextExtent Text$,1
StringBreite& = &(0)
GetTextExtent Text$,0
StringHoehe& = &(0)
Cls
Print
Print Text: + Text$
Print wide: + st$(Stringbreite&) + Pixel
Print Höhe : + st$(StringHoehe&) + Pixel
WaitInput
|
|
|
| |
|
|