Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Control's width based on its value
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00372954
Message ID:
00382871
Views:
21
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform