Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Control's width based on its value
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00372954
Message ID:
00382871
Vues:
19
I have a textbox control on a form with no border, backcolor same as the form's backcolor, background is opaque. The control is also sitting on top of a 3d line. I added the resize-form class from the VFP6 samples to the form. For some reason, the code makes the textbox stretch really far, obscuring the line under it. And it's really noticeable after the form is resized.

Help?


In the refresh event of the textbox control
	lnLength = len(This.Value)
	with This
	    lcStyle = iif(.FontBold, 'B', '') + iif(.FontItalic, 'I', '') + ;
	        iif(.FontCondense, 'C', '') + iif(.FontExtend, 'E', '') + ;
	        iif(.FontOutline, 'O', '') + iif(.FontShadow, 'S', '') + ;
	        iif(.FontStrikethru, '-', '') + iif(.FontUnderline, 'U', '')
	    lcStyle = iif(empty(lcStyle), 'N', lcStyle)
	    .Width  = min(txtwidth(replicate('W', lnLength), .FontName, ;
	        .FontSize, lcStyle) * fontmetric(6, .FontName, .FontSize, ;
	        lcStyle) + .Margin * 2 + iif(.SpecialEffect = 0, ;
	        6, 0) + 2, Thisform.Width - .Left - 5)
	endwith
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform