English
Source / code snippets

spending Bestimm Strings Textbreite Texthöhe

 

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
 
07/15/07  
 



Zum Quelltext


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

3.486 Views

Untitledvor 0 min.
RudiB.04/19/22
Sven Bader07/20/21
Mindanao06/03/17
Torben Nissen03/05/17
More...

Themeninformationen

this Topic has 1 subscriber:

unbekannt (1x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie