Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Dynamic Resizing of Form it's objects based on scrn. res
Message
De
20/06/1997 14:57:14
 
 
À
20/06/1997 14:51:40
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00036852
Message ID:
00037194
Vues:
31
>Hi!
>
>I found and use the following code and it work fine:
>
>1. Create a new form while under 640x480 resolution. Add some controls such
> as text boxes, command buttons, and labels to the form.
>
>2. Place the following code in the Init event of the form and in the Init
>event of any container objects such as a page on a pageframe that are on
>the form:
>
> ** Assumes a screen built at 640x480
> Local lnHeight, lnWidth, lnHeightdiff, lnWidthdiff
> lnHeight=640 && The height of the original resolution
> lnWidth=480 && The width of the original resolution
> lnHeightdiff=0 && Variable to hold the height difference
> lnWidthdiff=0 && Variable to hold the width difference
> IF SYSMETRIC(1)<>lnHeight && If this is not 640x480 resolution
> lnHeightdiff=SYSMETRIC(1)/lnHeight
> lnWidthdiff=SYSMETRIC(2)/lnWidth
>
> ** You need to remark out the next four lines of code if this is in
>the Init of a container object such as a page on a pageframe,
> ** or any other non-form container object that has a Controls and
>** ControlsCount property.
>
> THIS.Height=THIS.height*lnHeightdiff
> THIS.Width=THIS.Width*lnWidthdiff
> THIS.Top=THIS.Top*lnHeightdiff
> THIS.Left=THIS.Left*lnHeightDiff
>
> ** The code goes through each object, resizes and
> ** repositions it.
>
> FOR i = 1 to THIS.ControlCount
> WITH THIS.controls(i)
> .Height=.Height*lnHeightdiff
> .Width=.Width*lnWidthdiff
> .Top=.Top*lnHeightdiff
> .Left=.Left*lnWidthdiff
>
> ** You could also resize the font at this point
> ** by changing the FontSize property, perhaps to
> **.FontSize=.Fontsize*((.5*lnWidthdiff)+(.5*lnHeightdiff))
> ** However, some higher screen resolutions can change
> ** the appearance of fonts considerably, so testing is
> ** advised before trying that step.
>
> ENDWITH
> ENDFOR
> ENDIF
> THISFORM.Refresh
>
>
>Have a happy day
>Vladimir Shevchenko
>
Yes, I meant exactly this saying about 'own' resizer. The above code could be improved by:
1. Going inside Container objects (Grid, Pageframe, etc.)
2. FontSize really should be checked (too low font will invoke error) by
ON ERROR DO donothing
Edward Pikman
Independent Consultant
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform