Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Height of Text
Message
 
 
À
20/02/2002 05:52:54
Lutz Scheffler (En ligne)
Lutz Scheffler Software Ingenieurbüro
Dresden, Allemagne
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Divers
Thread ID:
00621982
Message ID:
00622491
Vues:
29
>Gregory,
>thank you for your help.
>
>After looking into your code I stumble over .INTEGRALHEIGHT.
>
>This was finally what I need. It works not alone, but it is the final hint.
>The following code will explain how I set WIDTH and HEIGHT depending on VALUE and FONT*.
>
>Now it works fine
>
>WITH oEditbox
> LOCAL;
>  laLines(1),;
>  lnLines  AS INTEGER,;
>  lnLoop1  AS INTEGER,;
>  lnWidth  AS INTEGER,;
>  lcFontStyle AS CHARACTER,;
>  lnFontMetric AS NUMBER,;
>  lnLineHeight AS NUMBER
>
> lnWidth = 2
>
> lcFontStyle =;
>  IIF(.FONTBOLD,"B","") + ;
>  IIF(.FONTITALIC,"I","") + ;
>  IIF(.FONTSTRIKETHRU,"-","") + ;
>  IIF(.FONTUNDERLINE,"U","")
>
> lnFontMetric = FONTMETRIC(6,.FONTNAME,.FONTSIZE,lcFontStyle)
> lnLineHeight = FONTMETRIC(1,.FONTNAME,.FONTSIZE,lcFontStyle)
>
> lnLines = ALINES(laLines,.VALUE,.F.)
> FOR lnLoop1 = 1 TO lnLines
>  lnWidth = MAX(lnWidth,;
>   CEILING(TXTWIDTH(laLines(lnLoop1), ;
>   .FONTNAME,.FONTSIZE,lcFontStyle)+1)*;
>   lnFontMetric)
> ENDFOR &&lnLoop1
> .WIDTH  = lnWidth+2+IIF(!EMPTY(.SCROLLBARS),SYSMETRIC(SYSMETRIC_VSCROLLBARWIDTH),0)
>
> .INTEGRALHEIGHT = .T.
>
>*smaller than one line
> .HEIGHT = 2
>*next two Lines Start .INTEGRALHEIGHT
> .FONTSIZE = .FONTSIZE-1
> .FONTSIZE = .FONTSIZE+1
>*now we display exact one complete line.
>
>*one line is FONTMETRIC(1,...)  + gap (figured out this rule manually)
>*n lines is n*FONTMETRIC(1,...) + gap (   "                          )
>
>*now we display just ONE line:
>*   gap is .HEIGHT-FONTMETRIC(1,...)
>*also .HEIGHT to display all is:
> .HEIGHT = lnLines*lnLineHeight+;	&&Lines+
> (.HEIGHT-lnLineHeight)			&&gap
>*q.e.d
>ENDWITH &&oEditbox
>
>
>Agnes
>
>Sergey, Thank you to, can't forward this to you, the CC buttons are gone ...

You're welcome. Consider adding this code to the faq section.
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform