Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Reduce/Enlarge windows isometrically
Message
From
09/07/1997 14:31:02
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00039056
Message ID:
00039139
Views:
30
>>>>Can someone tell me, how I can ensure, that a window could be reduce
>>>>or enlarge only isometrically? (I mean the height and width ratio stays the same.) Is it possible or not?
>>>>
>>>>Thanks in advance.
>>>>
>>>>BB
>>>
>>>Yes it is possible. Each form as a Height and Width property. You can determine the ration of height/width, change the height or the width then calculate the other using the ratio.
>>>
>>>nRatio=ThisForm.Width/ThisForm.Height
>>>ThisForm.Width=ThisForm.Width+50 && or shrink it by subtracting
>>>ThisForm.Height=ThisForm.Width/nRatio
>>>
>>>You could also set up this code in a separate UDF and call it from with the form to resize it.
>>>
>>>HTH
>>
>>Thank you for your answer!
>>To use your suggestion, I need to determine the last value of width or height. (To decide
>>which one was changed, because to set the unchanged other one. Or if both of them was changed,
>>select the more changed one.) But how can determine this value? The form resize event is called
>>continously. If I add two properties to the form (e.g. lastheight and lastwidth),
>>when should I set it to new value?
>>
>>Thanks in advice:
>>
>>BB
>
>I would set the initial values in the INIT method of the form:
>
>ThisForm.LastHeight = ThisForm.Height
>ThisForm.LastWidth = ThisForm.Width
>
>You can then call your resizing function in the Resize method of the form.


You misunderstand me, a bit. Let's assume, the user strecth the width of the window
for bigger size. Then the program have to adjust the height the window to ensure the original ratio.
The problem is, that in the resize event code, the program have to decide which window size
was changed, to match the other size to this. I thought, that it's easy to recognize the changing if
there are old values to compare to. But what does old value mean in this case? I am not certain, if
I set a property in the resize event (all the time, when it is called) and adjust the size based on this,
I get the right method, because resize event is called continously during resizing.
I hoped, probably probably there is a well known
algorythm for this, which I don't know, because I am a newcomer in VFP.

But thank you again for your answer:
BB
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform