Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Yousfi Benameur
  Where is Yousfi Benameur?
 El Bayadh
 Algeria
 Yousfi Benameur
 To: Russell Hill
  Where is Russell Hill?
 Sydney
 Australia
 Russell Hill
 Tags
Subject: RE: Design using Courier New
Thread ID: 209480 Message ID: 209704 # Views: 1 # Ratings: 0
Version: Visual FoxPro 9 Category: General VFP Topics
Date: Tuesday, December 30, 2008 2:41:53 PM         
   


> >
> > Hi Russel
> > GdiplusX can retrieve that with a high precision.
> > you must have system.app (or download it in codeplex)
> >
> > do locfile("system.app")
> > WITH _SCREEN.System.Drawing
> > .graphicsUnit="Pixel"
> > ystring="Happy new year 2009"
> > logfx= .Graphics.FromImage(.bitmap.new(10,100)) &&just for retrieve the logfx
> >    loFont = .Font.New("Arial black", 24,  .FontStyle.Regular)  &&regular font style
> > 	loSizeF = loGfx.MeasureString(ystring, loFont)
> > messagebox("string width ="+trans(losizeF.width)+chr(13)+"string height ="+trans(losizeF.height))
> > endwith
> > 

> > units are in pixels.you can evaluate the width and height of your textbox.
> > Regards
>
> Yousfi.
>
> You mention "textbox" at the end of your reply.
>
> Just to confirm, is the above code related to columns in a Grid?
>
> Thanks,
>
> Russell.
>
> p.s. The TextBox stuff works great from your other reply in this thread (see below).
>
>
>
>
>
>
>
>
>
>

Hi Russel
I compare the two solutions gdiplusX and txtWidth, but i dont find the same result.
I thinks gdiplusX solution is applied only to imagecanvas (graphics on device context).
For the grid: the column have a width property. We can apply txtWidth to the column.txt1 contents like it be applied to textbox.
You can dynamically change the width of a column.
if you put a grid and a button with the code
thisform.grid1.column1.width=thisform.grid1.column1.width+20

you can see directly the resize of the first column.
you have vfp9, i prefer you work with the property "allowAutoColuimnFit" who resize automatically your column.
Regards

ENTIRE THREAD

Design using Courier New Posted by Russell Hill @ 12/29/2008 8:55:58 AM
RE: Design using Courier New Posted by Samir Ibrahim @ 12/29/2008 9:47:24 AM
RE: Design using Courier New Posted by Russell Hill @ 12/29/2008 12:24:49 PM
RE: Design using Courier New Posted by Mike Yearwood @ 12/29/2008 7:58:23 PM
RE: Design using Courier New Posted by Samir Ibrahim @ 12/30/2008 10:32:13 AM
RE: Design using Courier New Posted by Stefan Wuebbe @ 12/30/2008 10:46:07 AM
RE: Design using Courier New Posted by Stefan Wuebbe @ 12/29/2008 9:49:08 AM
RE: Design using Courier New Posted by Russell Hill @ 12/29/2008 12:23:04 PM
RE: Design using Courier New Posted by Stefan Wuebbe @ 12/29/2008 5:49:35 PM
RE: Design using Courier New Posted by Russell Hill @ 12/31/2008 1:54:57 AM
RE: Design using Courier New Posted by Gerrit Masee @ 12/29/2008 10:33:40 AM
RE: Design using Courier New Posted by Russell Hill @ 12/29/2008 12:29:21 PM
RE: Design using Courier New Posted by Cetin Basoz @ 12/29/2008 12:23:39 PM
RE: Design using Courier New Posted by Russell Hill @ 12/29/2008 12:27:04 PM
RE: Design using Courier New Posted by tushar @ 12/29/2008 1:18:59 PM
RE: Design using Courier New Posted by Yousfi Benameur @ 12/29/2008 5:12:38 PM
RE: Design using Courier New Posted by Russell Hill @ 12/30/2008 6:11:13 AM
RE: Design using Courier New Posted by Yousfi Benameur @ 12/30/2008 2:41:53 PM
RE: Design using Courier New Posted by Russell Hill @ 12/31/2008 1:54:13 AM
RE: Design using Courier New Posted by Yousfi Benameur @ 12/31/2008 10:16:43 AM
RE: Design using Courier New Posted by Yousfi Benameur @ 12/30/2008 12:14:50 AM
RE: Design using Courier New Posted by Russell Hill @ 12/30/2008 4:12:26 AM
RE: Design using Courier New Posted by Andy Kramek @ 12/31/2008 11:54:33 AM
RE: Design using Courier New Posted by Yousfi Benameur @ 12/31/2008 12:33:17 PM