Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Forms and screen resolution
Message
De
27/04/2009 14:32:16
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
01396126
Message ID:
01396544
Vues:
83
Marcia, I got as far as "Add a custom method called ResizeControls to your form class and put the code below into it" so I did and it tells me: Methods and events cannot contain nested procedures or class definitions. Did I err somewhere? I
guess it doesn't like the " Procedure Init" in there. can I eliminate it or put it elsewherE?


Sorry - copy and paste error; Put this code in ResizeControls:

>>>>
>>>>    Lparameters toControl
>>>>    Local loPage, loControl, loColumn, lnColumnWidths[1], lnCol
>>>>
>>>>    If Pemstatus( toControl, 'Width', 5 )
>>>>      toControl.Width = toControl.Width * Thisform.widthratio
>>>>    Endif
>>>>    If Pemstatus( toControl, 'Height', 5 )
>>>>      toControl.Height = toControl.Height * Thisform.heightratio
>>>>    Endif
>>>>    If Pemstatus( toControl, 'Top', 5 )
>>>>      toControl.Top = toControl.Top * Thisform.heightratio
>>>>    Endif
>>>>    If Pemstatus( toControl, 'Left', 5 )
>>>>      toControl.Left = toControl.Left * Thisform.heightratio
>>>>    Endif
>>>>    *** Now resize the font of the control, grid (naturally <g>) is a special case because
>>>>    *** resizing the font resizes the column widths of the grid, so save and restore them
>>>>    If Upper( Alltrim( toControl.BaseClass ) ) = 'GRID'
>>>>      Dimension lnColumnWidths[toControl.ColumnCount]
>>>>      For lnCol = 1 To toControl.ColumnCount
>>>>        lnColumnWidths[lnCol] = toControl.Columns[lnCol].Width
>>>>      Endfor
>>>>      toControl.FontSize = Int( toControl.FontSize * Thisform.widthratio )
>>>>      For lnCol = 1 To toControl.ColumnCount
>>>>        toControl.Columns[lnCol].Width = lnColumnWidths[lnCol]
>>>>      Endfor
>>>>    Else
>>>>      If Pemstatus( toControl, 'Fontsize', 5 )
>>>>        toControl.FontSize = Int( toControl.FontSize * Thisform.widthratio )
>>>>      Endif
>>>>    Endif
>>>>    Do Case
>>>>      Case Upper( toControl.BaseClass ) = 'PAGEFRAME'
>>>>        For Each loPage In toControl.Pages
>>>>          Thisform.resizecontrols( loPage )
>>>>        Endfor
>>>>
>>>>      Case Inlist( Upper( toControl.BaseClass ), 'PAGE', 'CONTAINER' )
>>>>        For Each loControl In toControl.Controls
>>>>          Thisform.resizecontrols( loControl )
>>>>        Endfor
>>>>
>>>>      Case Upper( toControl.BaseClass ) = 'GRID'
>>>>        With toControl
>>>>          .RowHeight     = .RowHeight * Thisform.heightratio
>>>>          .HeaderHeight  = .HeaderHeight * Thisform.heightratio
>>>>          For Each loColumn In .Columns
>>>>            loColumn.Width = loColumn.Width * Thisform.widthratio
>>>>          Endfor
>>>>        Endwith
>>>>
>>>>      Case Inlist( Upper( toControl.BaseClass ), 'COMBOBOX', 'LISTBOX' )
>>>>        Local lnCol, lnStart, lnEnd, lnLen, lcColumnWidths
>>>>        With toControl
>>>>          If .ColumnCount < 2
>>>>            .ColumnWidths = Alltrim( Str( .Width ) )
>>>>          Else
>>>>            lcColumnWidths = ''
>>>>            lnStart = 1
>>>>            For lnCol = 1 To .ColumnCount - 1
>>>>              lnEnd = At( ',', .ColumnWidths, lnCol )
>>>>              lnLen = lnEnd - lnStart
>>>>              lcColumnWidths = lcColumnWidths + Iif( Empty( lcColumnWidths ), '', ',' ) + Alltrim( Str( Val (Substr( .ColumnWidths, lnStart, lnLen ) ) * Thisform.widthratio ) )
>>>>              lnStart = lnEnd + 1
>>>>            Endfor
>>>>            lnLen = Len( .ColumnWidths ) - lnStart + 1
>>>>            lcColumnWidths = lcColumnWidths + ',' + Alltrim( Str( Val (Substr( .ColumnWidths, lnStart, lnLen ) ) * Thisform.widthratio ) )
>>>>            .ColumnWidths = lcColumnWidths
>>>>          Endif
>>>>        Endwith
>>>>
>>>>      Case Inlist( Upper( Alltrim( toControl.BaseClass ) ), 'COMMANDGROUP', 'OPTIONGROUP' )
>>>>        Local lnButton
>>>>        For lnButton = 1 To toControl.ButtonCount
>>>>          Thisform.resizecontrols( toControl.Buttons[lnButton] )
>>>>        Endfor
>>>>
>>>>      Otherwise
>>>>        *** There is no otherwise...I think we got all cases
>>>>    Endcase
>>>>
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform