In a message regarding RE: RB2007 and TextSize dated Sat, 31 Mar 2007
15:57:37 -0400, RBNUBE said that ...
> Since the above doesn't work as I would like, is there a way to get the
> *true* default point size instead of the "0" set in the properties pane?
> Would I have to use declares to do this?
You could probably get away with a method something like this.
Function TrueSize(ef as editfield) As Integer
if ef.TextSize <> 0 then Return ef.TextSize
dim p as new Picture( 0, 0, 2)
dim g as Graphics = p.Graphics
dim sh, shSav as Integer
g.TextFont = ef.TextFont
g.Bold = ef.Bold
g.Italic = ef.Italic
g.Underline = ef.Underline
g.TextSize = ef.TextSize
shSav = g.StringHeight( "Why", 32000 )
g.TextSize = 11
sh = g.StringHeight( "Why", 32000 )
If sh < shSav Then
do
g.TextSize = g.TextSize + 1
sh = g.StringHeight( "Why", 32000 )
loop until sh >= shSav
elseif sh > shSav Then
do
g.TextSize = g.TextSize - 1
sh = g.StringHeight( "Why", 32000 )
loop until sh >= shSav or g.TextSize = 0
end if
Return g.TextSize
End Function
--
Steve Garman
Using REALbasic Professional on Windows XP Pro
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>
|