Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Height of Text
Message
De
20/02/2002 04:50:08
 
 
À
20/02/2002 04:36:41
Lutz Scheffler (En ligne)
Lutz Scheffler Software Ingenieurbüro
Dresden, Allemagne
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Divers
Thread ID:
00621982
Message ID:
00622403
Vues:
32
Agnes,

Don't see eny harm in that, and I would maybe set the form settings back

Here is version 3 with yur changes incorporated
LPARAMETERS nkeycode,nshiftaltctrl

if( chr(nkeycode) == 't' )
	NODEFAULT
	
	local t_FONTNAME, t_FONTSIZE, t_FONTBOLD, t_FONTITALIC, t_FONTSTRIKETHRU, t_FONTUNDERLINE
	local LockScreen
	LockScreen = thisform.LockScreen
	thisform.LockScreen = .T.
	
	t_FONTNAME	= THISFORM.FONTNAME
	t_FONTSIZE	= THISFORM.FONTSIZE
	t_FONTBOLD	= THISFORM.FONTBOLD
	t_FONTITALIC= THISFORM.FONTITALIC
	t_FONTSTRIKETHRU = THISFORM.FONTSTRIKETHRU
	t_FONTUNDERLINE	= THISFORM.FONTUNDERLINE
	
	THISFORM.FONTNAME        = THISFORM.myEdtBox.FONTNAME
	THISFORM.FONTSIZE        = THISFORM.myEdtBox.FONTSIZE
	THISFORM.FONTBOLD        = THISFORM.myEdtBox.FONTBOLD
	THISFORM.FONTITALIC      = THISFORM.myEdtBox.FONTITALIC
	THISFORM.FONTSTRIKETHRU  = THISFORM.myEdtBox.FONTSTRIKETHRU
	THISFORM.FONTUNDERLINE   = THISFORM.myEdtBox.FONTUNDERLINE

	local th, i, nlines, aa[1], OneLineHeight, EditBoxWidth
	
	th = thisform.TextHeight(thisform.myEdtBox.value)
	nlines = alines(aa, thisform.myEdtBox.value, .F.)
	
	
	if( !empty(nLines) )
		OneLineHeight = th/nlines
		
		EditBoxWidth = thisform.myEdtBox.Width - iif(!empty(thisform.myEdtBox.Scrollbars), sysmetric(SYSMETRIC_VSCROLLBARWIDTH), 0)
		for i = 1 to nlines
			if( thisform.textwidth(aa[i]) > EditBoxWidth )
				th = th + OneLineHeight 
			endif
		endfor
	endif
	
	thisform.myEdtBox.Height = max(th, 45)
	
	THISFORM.FONTNAME        = t_FONTNAME
	THISFORM.FONTSIZE        = t_FONTSIZE
	THISFORM.FONTBOLD        = t_FONTBOLD
	THISFORM.FONTITALIC      = t_FONTITALIC
	THISFORM.FONTSTRIKETHRU  = t_FONTSTRIKETHRU
	THISFORM.FONTUNDERLINE	 = t_FONTUNDERLINE
	
	thisform.LockScreen = LockScreen
else
	return DoDefault(nkeycode,nshiftaltctrl)
endif
>Hi Gregory,
>since I change FONT* would this be correct approach?
>
>THISFORM.FONTNAME        = THISFORM.myEdtBox.FONTNAME
>THISFORM.FONTSIZE        = THISFORM.myEdtBox.FONTSIZE
>THISFORM.FONTBOLD        = THISFORM.myEdtBox.FONTBOLD
>THISFORM.FONTITALIC      = THISFORM.myEdtBox.FONTITALIC
>THISFORM.FONTSTRIKETHRU  = THISFORM.myEdtBox.FONTSTRIKETHRU
>THISFORM.FONTUNDERLINE   = THISFORM.myEdtBox.FONTUNDERLINE
>THISFORM.myEdtBox.HEIGHT = THISFORM.TEXTHEIGHT(THISFORM.myEdtBox.Value)
>THISFORM.myEdtBox.WIDTH  = THISFORM.TEXTWIDTH(THISFORM.myEdtBox.Value)
>
>Never mind that I can exceed form's limits.
>
>Is there any harm to THISFORM?
>
>Agnes
>>Agnes,
>>
>>Without having looked at the other thread ..
>>
>>Not taking into account that a line may overflow due to the width of the editbox, the following gets good results IMO and may get you where you want.
>>Have a look at it and see whether it can be of any help
>>
>>
>>? thisform.TextHeight(thisform.Editbox1.text)
>>
Gregory
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform