Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Multiple Screen Resolutions
Message
De
05/11/1998 13:17:42
 
 
À
05/11/1998 13:00:31
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00154915
Message ID:
00154928
Vues:
41
>I am writing a VFP 3.0 app which will be run on resolutions from 640x380 up to 1024x768. I developed it in 1024x768 resolution. The Microsoft KB has suggested code, but it doesn't work correctly - it squeezes the forms and pageframes horizontally to the left. Also, I have command buttons on the pageframe pages, and only the leftmost buttons appear on the screen when I switch resolutions.
>
>Anyone have an idea how to solve this problem?
>
>Thanks,
>
>Alan Zaben
>cancer_survivor@yahoo.com
Hi Alan.

Some variation of the following code should do the trick for you:
IF SYSMETRIC(1) <> 640 THEN
   #DEFINE HEIGHTRATIO SYSMETRIC(2)/480
   #DEFINE WIDTHRATIO  SYSMETRIC(1)/640
   = AMEMBERS(FrmObjArray, This, 2)  && Array containing Form objects
   IF ASCAN(FrmObjArray,"PAGEFRAME1") > 0 THEN	&& Form contains pages
      WITH THIS.PageFrame1
      FOR ii = 1 TO .PageCount
          FOR jj = 1 TO .Pages(ii).ControlCount
*         Resize and reposition the controls on each page
              .Pages(ii).Controls[jj].Width  = .Pages(ii).Controls[jj].Width  * WIDTHRATIO   
              .Pages(ii).Controls[jj].Height = .Pages(ii).Controls[jj].Height * HEIGHTRATIO   
              .Pages(ii).Controls[jj].Left   = .Pages(ii).Controls[jj].Left   * WIDTHRATIO          
              .Pages(ii).Controls[jj].Top    = .Pages(ii).Controls[jj].Top    * HEIGHTRATIO   
               IF (.Pages(ii).Controls[jj].BaseClass = "Commandgroup") OR (.Pages(ii).Controls[jj].BaseClass = "Optiongroup") THEN
                   WITH THIS.PageFrame1.Pages(ii).Controls[jj]
                   FOR kk = 1 TO .ButtonCount
*                  Resize and reposition the buttons within each control group
                      .Buttons[kk].Width  = .Buttons[kk].Width  * WIDTHRATIO   
                      .Buttons[kk].Height = .Buttons[kk].Height * HEIGHTRATIO   
                      .Buttons[kk].Left   = .Buttons[kk].Left   * WIDTHRATIO          
                      .Buttons[kk].Top    = .Buttons[kk].Top    * HEIGHTRATIO   
                   ENDFOR
                   ENDWITH
               ENDIF
          ENDFOR    
*         Change the font size
          IF SYSMETRIC(1) = 800 THEN
             .Pages(ii).SetAll("Fontsize",12)
          ELSE
             IF SYSMETRIC(1) = 1024 THEN
                .Pages(ii).SetAll("Fontsize",16)
             ENDIF
          ENDIF
      ENDFOR
      ENDWITH
   ENDIF          
   WITH THISFORM
*  Resize and reposition the controls
   FOR xx = 1 TO .ControlCount
       .Controls[xx].Width  = .Controls[xx].Width  * WIDTHRATIO   
       .Controls[xx].Height = .Controls[xx].Height * HEIGHTRATIO   
       .Controls[xx].Left   = .Controls[xx].Left   * WIDTHRATIO          
       .Controls[xx].Top    = .Controls[xx].Top    * HEIGHTRATIO   
   ENDFOR    
*  Resize and Re-position the Form   
   .Width  = .Width  * WIDTHRATIO
   .Height = .Height * HEIGHTRATIO   
   .Left   = .Left   * WIDTHRATIO
   .Top    = .Top    * HEIGHTRATIO      
*  Change the font size
   IF SYSMETRIC(1) = 800 THEN
      .SetAll("Fontsize",12)
   ELSE
      IF SYSMETRIC(1) = 1024 THEN
         .SetAll("Fontsize",16)
      ENDIF
   ENDIF       
   ENDWITH
ENDIF   
IF .NOT. z_TopScreen
  ThisForm.PageFrame1.ActivePage = 2
ENDIF
Marcia
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform