New topic: 

(RESOLVED) g.drawstring with wrap - finding the bottom...?

<http://forums.realsoftware.com/viewtopic.php?t=31445>

       Page 1 of 1
   [ 3 posts ]                 Previous topic | Next topic         Author  
Message       Wolfsnap           Post subject: (RESOLVED) g.drawstring with 
wrap - finding the bottom...?Posted: Mon Dec 07, 2009 1:42 am                   
     
Joined: Thu May 10, 2007 10:25 pm
Posts: 39              I am drawing text to a canvas, and need to have 
individual "blocks" of text that are multi-line. How can I determine where the 
first block ends (the Y position)?

Code:g.ForeColor = &c000000
g.TextSize = 10
g.Bold = True
g.Italic = True
g.DrawString ProcedureString, 10, 60, rCanvasCnv.Width - 40, false


If the above text wraps into multiple lines and I want to draw another chunk of 
text below it with a small space, how can I do it? Is there some way to get the 
last X,Y position from the last thing drawn...?      

    Last edited by Wolfsnap on Mon Dec 07, 2009 3:00 am, edited 1 time in 
total.   
                            Top               timhare           Post subject: 
Re: g.drawstring with wrap - finding the bottom...?Posted: Mon Dec 07, 2009 
2:11 am                        
Joined: Fri Jan 06, 2006 3:21 pm
Posts: 6899
Location: Portland, OR  USA              You can get the height of the block 
with

Y = 60 // the previous Y you used in DrawString
Y = Y + g.StringHeight(ProcedureString, rCanvasCnv.Width - 40)
g.DrawString("Some more text", 10, Y)

Tim   
                            Top               Wolfsnap           Post subject: 
Re: g.drawstring with wrap - finding the bottom...?Posted: Mon Dec 07, 2009 
3:00 am                        
Joined: Thu May 10, 2007 10:25 pm
Posts: 39              Perfect! Exactly what I was needing!

Thanks Tim!   
                            Top           Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 3 posts ]     
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to