LEFT() and RIGHT() but in centimeters in stead of characters

LEFT() and RIGHT() but in centimeters in stead of characters

Postby driessen » Wed Dec 02, 2009 9:28 pm

Hello,

I'm looking for a function which can take a left or a right part of a string in centimeters.

I want to use this string to put into a Word document but the space I have is limited.

Since proportional fonts are used, I cannot use the normal LEFT() or RIGHT().

I hope I did make myself clear.

Thanks a lot in advance for any help.
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: LEFT() and RIGHT() but in centimeters in stead of characters

Postby Otto » Wed Dec 02, 2009 10:03 pm

Hello Michael,
I use this code:

Code: Select all  Expand view
while oWnd:GetWidth(text,oFont) < nPX
         n := n + 1
         text := padr( (cChartCaption) ,n)
      end
 


Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6329
Joined: Fri Oct 07, 2005 7:07 pm

Re: LEFT() and RIGHT() but in centimeters in stead of characters

Postby Otto » Thu Dec 24, 2009 10:15 am

Hello Michel,
I think I found a better solution:
Code: Select all  Expand view
DrawText( ::hDC, cCaption,{ nTxtTop, nTxtLeft, nTxtBottom, nTxtRight },nStyle  )
Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6329
Joined: Fri Oct 07, 2005 7:07 pm

Re: LEFT() and RIGHT() but in centimeters in stead of characters

Postby Otto » Fri Dec 25, 2009 5:05 pm

Hello Michel,
drawText works fine for me:

Best regards,
Otto

Image
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6329
Joined: Fri Oct 07, 2005 7:07 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 74 guests