Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Proportional resizing of forms
Message
From
21/02/2023 06:36:58
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
01686228
Message ID:
01686233
Views:
67
>Hi Tamar,
>
> Maybe this ...
>
>
>PUBLIC oform1
>
>oform1=NEWOBJECT("form1")
>oform1.Show
>RETURN
>
>
>	**************************************************
>*-- Form:         form1 (x:\xfrx\test\customers\tamar.scx)
>*-- ParentClass:  form
>*-- BaseClass:    form
>*-- Time Stamp:   02/20/23 07:57:01 PM
>*
>DEFINE CLASS form1 AS form
>
>
>	Top = 0
>	Left = 0
>	Height = 275
>	Width = 406
>	DoCreate = .T.
>	Caption = "Form1"
>	oldwidth = 0
>	oldheight = 0
>	Name = "Form1"
>
>
>	ADD OBJECT edit1 AS editbox WITH ;
>		Height = 120, ;
>		Left = 12, ;
>		Top = 11, ;
>		Width = 189, ;
>		Name = "Edit1"
>
>
>	ADD OBJECT edit2 AS editbox WITH ;
>		Height = 120, ;
>		Left = 205, ;
>		Top = 143, ;
>		Width = 189, ;
>		Name = "Edit2"
>
>
>	PROCEDURE Resize
>		*LOCAL 
>
>		lnRatioY = This.Height/This.OldHeight
>		lnRatioX = This.Width/This.OldWidth
>
>
>		WITH This.edit1
>		.Move(.nOrigLeft*lnRatioX, .nOrigTop*lnRatioY, .nOrigWidth*lnRatioX, .nOrigHeight*lnRatioY)
>		ENDWITH
>
>		WITH This.edit2
>		.Move(.nOrigLeft*lnRatioX, .nOrigTop*lnRatioY, .nOrigWidth*lnRatioX, .nOrigHeight*lnRatioY)
>		ENDWITH
>	ENDPROC
>
>
>	PROCEDURE Init
>		This.OldWidth=This.Width
>		This.OldHeight=This.Height
>	ENDPROC
>
>
>	PROCEDURE edit1.Init
>		This.AddProperty("nOrigWidth", This.Width) 
>		This.AddProperty("nOrigHeight", This.Height) 
>		This.AddProperty("nOrigLeft", This.Left) 
>		This.AddProperty("nOrigTop", This.Top) 
>	ENDPROC
>
>
>	PROCEDURE edit2.Init
>		This.AddProperty("nOrigWidth", This.Width) 
>		This.AddProperty("nOrigHeight", This.Height) 
>		This.AddProperty("nOrigLeft", This.Left) 
>		This.AddProperty("nOrigTop", This.Top) 
>	ENDPROC
>
>
>ENDDEFINE
>*
>*-- EndDefine: form1
>*************************************************
>
>
>MartinaJ

Thanks, Martina. The thing is that Anchor works fine for moving and resizing the controls on the form. What we're trying to do is manage the size of the form itself and keep it in the same ratio.

Tamar
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform