Cesar,
 
That got the demo going.  Now I will need to spend some time understanding how 
it works and how/if to incorporate the capabilities into my code.  Thanks,  Joe

On Tuesday, November 27, 2007 1:08 PM, Cesar wrote:
>
>Date: Tue, 27 Nov 2007 16:08:39 -0200
>From: Cesar
>To: [EMAIL PROTECTED]
>cc:
>Subject: re: GDI+
>
>Joe,
>
>In this discussion we're referring to the sample posted here:
>http://weblogs.foxite.com/cesarchalom/archive/2007/11/24/5428.aspx
>
>There's a remark on that article that says:
>
>Requires VFP9 and GdiPlusX to run.
>Please make sure that you have the latest version, because this sample may be 
>using some functions that were added or fixed recently. 
>http://www.codeplex.com/VFPX/Wiki/View.aspx?title=GDIPlusX&referringTitle=Home
>
>GdiPlusX is an open source project, and there you'll find the file 
>"system.prg" that the 1st line calls.
>
>You may also check the other projects in Codeplex, I'm sure you'll find some 
>great things there.
>
>HTH
>
>Cesar
>
>
>---------- Início da mensagem original ----------- 
>De: [EMAIL PROTECTED] 
>Para: [EMAIL PROTECTED] 
>Cc: 
>Data: Tue, 27 Nov 2007 12:07:29 -0500 
>Assunto: re: GDI+ 
>> I am new to GDI and thought I'd try the code. It dies on the first line 
>> as there is no "System.prg" on my machine. Perhaps this code is not 
>> meant to be stand alone. Can someone enlighten me? 
>> 
>> TIA - Joe Yoder 
>> 
>> On Monday, November 26, 2007 12:55 PM, Cesar wrote: 
>> > 
>> >Date: Mon, 26 Nov 2007 15:55:05 -0200 
>> >From: Cesar 
>> >To: [EMAIL PROTECTED] 
>> >cc: 
>> >Subject: RE: GDI+ 
>> > 
>> >Hi Chris, 
>> > 
>> >Please run the sample below, and tell me how it goes. 
>> >It runs without the GenericTypographic StringFormat. 
>> > 
>> >Instead of that I used CEILING() to round the measures obtained by Measure 
>> >String. 
>> > 
>> >In the original case, when the sample obtained 164,15 pixels, it created an 
>> >empty bitmap with the size of 164 pixels wide, instead of 165. 
>> > 
>> >In my tests, using CEILING() the problem was fixed. 
>> > 
>> > 
>> >What do you think Christof ??? 
>> > 
>> >DO LOCFILE("System.prg") 
>> >WITH _SCREEN.System.Drawing 
>> >LOCAL lcText 
>> >lcText = INPUTBOX("Type a string to create Image:") 
>> >* Create a Font 
>> >LOCAL loFont as xfcFont 
>> >loFont = _screen.system.Drawing.Font.New("Verdana", 32, 
>> >.FontStyle.BoldItalic) 
>> >LOCAL loTmpBmp as xfcBitmap 
>> >loTmpBmp = .Bitmap.New(1,1) 
>> >* Retrieve the graphics object. 
>> >LOCAL loTmpGfx AS xfcGraphics 
>> >loTmpGfx = .Graphics.FromImage(loTmpBmp) 
>> >* Measure the String 
>> >* Get the size required for our text 
>> >LOCAL loSize as xfcSize 
>> >loSize = loTmpGfx.MeasureString(lcText, loFont) 
>> >LOCAL loNewBmp as xfcBitmap 
>> >loNewBmp = .Bitmap.New(CEILING(loSize.Width), CEILING(loSize.Height)) 
>> >LOCAL loNewGfx as xfcGraphics 
>> >loNewGfx = .Graphics.FromImage(loNewBmp) 
>> >* Clear the background to Yellow 
>> >loNewGfx.Clear(.Color.Yellow) 
>> >* Create a solid brush 
>> >LOCAL loBrush as xfcSolidBrush 
>> >loBrush = .SolidBrush.New(.Color.FromRGB(255,0,0)) && Red 
>> >* Create an StringFormat object in order to draw the sting centered in the 
>> >image 
>> >LOCAL loStringFmt as xfcStringFormat 
>> >loStringFmt = .StringFormat.New() 
>> >loStringFmt.Alignment = .StringAlignment.Center 
>> >* Create a Rectangle with the measures of the Bitmap 
>> >LOCAL loRect as xfcRectangleF 
>> >loRect = loNewBmp.GetBounds() 
>> >* Draw the String 
>> >loNewGfx.DrawString(lcText, loFont, loBrush, loRect, loStringFmt) 
>> >* Finally save the image 
>> >loNewBmp.Save("c:\MyText.Png", .Imaging.ImageFormat.Png) 
>> >* Show the image 
>> >RUN /N Explorer.exe c:\Mytext.Png 
>> >ENDWITH 
>> > 
>> > 
>> >---------- Início da mensagem original ----------- 
>> >De: [EMAIL PROTECTED] 
>> >Para: [EMAIL PROTECTED] 
>> >Cc: 
>> >Data: Mon, 26 Nov 2007 17:30:02 -0000 
>> >Assunto: RE: GDI+ 
>> >> Cesar, 
>> >> 
>> >> Is this something I can fix my end, or should I be waiting for an update 
>> >> to 
>> >> the GdiPlusX stuff ? 
>> >> 
>> >> Cheers 
>> >> 
>> >> Chris. 
>> >> 
>> >> P.S. Any thoughts about the report side of things. 
>> >> 
>> >> -----Original Message----- 
>> >> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf 
>> >> Of Cesar 
>> >> Sent: 26 November 2007 16:40 
>> >> To: profox 
>> >> Subject: RE: GDI+ 
>> >> 
>> >> Hey Christof ! 
>> >> 
>> >> ROUND() did the magic. 
>> >> 
>> >> Thanks a lot ! 
>> >> 
>> >> 
>> >> ---------- Início da mensagem original ----------- 
>> >> De: [EMAIL PROTECTED] 
>> >> Para: [EMAIL PROTECTED] 
>> >> Cc: 
>> >> Data: Mon, 26 Nov 2007 17:37:07 +0100 
>> >> Assunto: RE: GDI+ 
>> >> > Hi Cesar, 
>> >> > 
>> >> > > Even using the cloned Generic Typographic, together with "Measure 
>> >> trailing 
>> >> > spaces" etc, I still get the missing pixel. 
>> >> > 
>> >> > One pixel sounds like PixelOffsetMode is kicking in. Try setting 
>> >> > Graphics.PixelOffsetMode to 4. Also, as GDI+ allows floating point 
>> >> > values 
>> >> > instead of integers for position and size, I found it necessary to 
>> >> > apply 
>> >> > ROUND(xxx,0) for any position or dimension value. Otherwise I would get 
>> >> > occasionally an off-by-one-pixel error. 
>> >> > 
>> >> > -- 
>> >> > Christof 
>> >> > 
>> >> > 
>> >> > 
>> >> > 
[excessive quoting removed by server]

_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to