New topic: 

Picture Size from Graphics Text Size

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

         Page 1 of 1
   [ 2 posts ]                 Previous topic | Next topic          Author  
Message        neonash7777          Post subject: Picture Size from Graphics 
Text SizePosted: Mon Oct 29, 2012 4:06 pm                         
Joined: Mon Nov 29, 2010 7:01 pm
Posts: 301                I want to use the graphics.stringwidth function where 
I don't have an instance of a graphic yet
dim g as new Graphics
g.TextUnit = FontUnits.Pixel
g.TextSize = 12
dim length as integer = g.stringwidth(s)

//then I want to create an image with the given width of length
dim p as new picture(length+4,16)


The problem is that I can't create a new instance of the graphics class.

But I don't know how big to make my picture because I don't know how long the 
text is going to be.

Is there an easy way around this?   
                             Top                DaveS          Post subject: 
Re: Picture Size from Graphics Text SizePosted: Mon Oct 29, 2012 4:30 pm        
                         
Joined: Sun Aug 05, 2007 10:46 am
Posts: 4205
Location: San Diego, CA                create a PICTURE
dim p as picture
dim g as Graphics
p=new picture(32,32,32)
g=p.graphics
g.TextUnit = FontUnits.Pixel
g.TextSize = 12
dim length as integer = g.stringwidth(s)
      
_________________
Dave Sisemore
MacPro, OSX Lion 10.7.4 RB2012r1
Note : I am not  interested in any solutions that involve custom Plug-ins of 
any kind  
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 2 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