Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Height of Text
Message
De
20/02/2002 04:37:09
 
 
À
19/02/2002 11:32:25
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Allemagne
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Divers
Thread ID:
00621982
Message ID:
00622401
Vues:
31
>Hi All,
>
>How can I calculate the height of a control (editbox) to show all lines of a string?
>
>Thanks in advance
>
>Agnes

Agnes,

this seems to work (more or less)
_edit = editbox
&& form.Keypress
LPARAMETERS nkeycode,nshiftaltctrl

if( chr(nkeycode) == 't' )
	NODEFAULT
	
	local th, i, nlines, aa[1], OneLineHeight, EditBoxWidth
	
	th = thisform.TextHeight(thisform._edit.value)
	nlines = alines(aa, thisform._edit.value, .F.)
	acti screen
	?'--'
	?thisform._edit.Value
	?'--'
	
	if( !empty(nLines) )
		OneLineHeight = th/nlines
		acti screen
		?th, OneLineHeight 
		EditBoxWidth = thisform._edit.Width - iif(!empty(thisform._edit.Scrollbars), sysmetric(SYSMETRIC_VSCROLLBARWIDTH), 0)
		for i = 1 to nlines
			if( thisform.textwidth(aa[i]) > EditBoxWidth )
				th = th + OneLineHeight 
			endif
		endfor
	endif
	
	thisform._Edit.Height = max(th, 45) && or scrollbars disappear
	acti screen
	?th
else
	return DoDefault(nkeycode,nshiftaltctrl)
endif
Gregory
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform