FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour bmptxt
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM

bmptxt

Posted: Sun Jan 20, 2008 08:49 AM

I saw bmptxt.prg sample
Howe I can modify the font to insert a big text ?

Best Regards, Saludos



Falconi Silvio
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM

Re: bmptxt

Posted: Sun Jan 20, 2008 01:17 PM

I can't find that sample in latest FWH.

EMG

Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM

bmptxt

Posted: Mon Jan 21, 2008 09:48 AM

you must see well !!
CMq I revolve i thanks

Best Regards, Saludos



Falconi Silvio
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM

bmptxt

Posted: Mon Jan 21, 2008 11:11 AM

I confirm: a file called bmptxt.prg doesn't exists in FWH.

EMG

Posts: 6984
Joined: Fri Oct 07, 2005 07:07 PM

bmptxt

Posted: Mon Jan 21, 2008 11:13 AM

I have one in my FWH 8.01 sample folder.
Size 558 03-04-1996

Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM

bmptxt

Posted: Mon Jan 21, 2008 11:39 AM

Its name is bmptext.prg not bmptxt.prg. That's why I did not find it.

EMG

Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM

Re: bmptxt

Posted: Mon Jan 21, 2008 11:41 AM
Silvio wrote:I saw bmptxt.prg sample
Howe I can modify the font to insert a big text ?


Just define your own font and pass it as fifth parameter to the function TextOut().

EMG
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM

bmptxt

Posted: Mon Jan 21, 2008 12:11 PM

Quanto la fai difficile : ti ho detto che ho risolto..!!!

Best Regards, Saludos



Falconi Silvio
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Posts: 6984
Joined: Fri Oct 07, 2005 07:07 PM

bmptxt

Posted: Mon Jan 21, 2008 01:38 PM

Enrico,
I tried your suggestion but this does not work.
Regards,
Otto
// Placing text on top of a bitmap

include "FiveWin.ch"

define TRANSPARENT 1

static oWnd
//----------------------------------------------------------------//
function Main()
local oBmp, oFntGross
//oFntGross:= ChooseFont()
DEFINE FONT oFntGross NAME "MS Sans Serif" SIZE 10,15 BOLD

DEFINE WINDOW oWnd TITLE "Text on a bitmap"

@ 1, 1 BITMAP oBmp FILENAME "..\bitmaps\fw.bmp" OF oWnd

oBmp:bPainted = { || SetBkMode( oBmp:hDC, TRANSPARENT ),;
TextOut( oBmp:hDC, 15, 15, "Hello",oFntGross ) }

ACTIVATE WINDOW oWnd

return nil

//----------------------------------------------------------------//

Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM

bmptxt

Posted: Mon Jan 21, 2008 01:46 PM

NO you must this
holdfnt:=selectobject( hdc,ofont:hfont)
and the you can use texout

bye

Best Regards, Saludos



Falconi Silvio
Posts: 6984
Joined: Fri Oct 07, 2005 07:07 PM

bmptxt

Posted: Mon Jan 21, 2008 04:00 PM

Silvio, could you provide a working sample.
Thanks in advance
Otto

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM

bmptxt

Posted: Mon Jan 21, 2008 05:28 PM
Please try this
   oBmp:bPainted  := { |hDC| OnPaint( hDC, "BOLD TEXT", oFntGross ) }

.......
.......
static function OnPaint( hDC, cMsg, oFont )

   local hOldFont

   hOldFont := SelectObject( hDC, oFont:hFont )
   SetBkMode( hDC, TRANSPARENT )
   TextOut( hDC, 5, 5, cMsg )
   SelectObject( hDC, hOldFont )

return nil
Regards



G. N. Rao.

Hyderabad, India
Posts: 6984
Joined: Fri Oct 07, 2005 07:07 PM

bmptxt

Posted: Mon Jan 21, 2008 05:50 PM

Thank you NageswaraRao,
I miss something:
Error description: Error BASE/1004 No exported method: HFONT
Regards,
Otto
// Placing text on top of a bitmap

include "FiveWin.ch"

define TRANSPARENT 1

static oWnd

//----------------------------------------------------------------//

function Main()
Local oBmp, oFont

DEFINE FONT oFont

oFont := ChooseFont()

DEFINE WINDOW oWnd TITLE "Text on a bitmap"

@ 1, 1 BITMAP oBmp FILENAME "..\bitmaps\fw.bmp" OF oWnd

oBmp:bPainted  := { |hDC| OnPaint( hDC, "BOLD TEXT", oFont ) }

ACTIVATE WINDOW oWnd

return nil

//----------------------------------------------------------------//

static function OnPaint( hDC, cMsg, oFont )

local hOldFont

hOldFont := SelectObject( hDC, oFont:hFont )
SetBkMode( hDC, TRANSPARENT )
TextOut( hDC, 5, 5, cMsg )
SelectObject( hDC, hOldFont )

return nil

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM

bmptxt

Posted: Mon Jan 21, 2008 05:54 PM

Mr Otto

First try with defining the font. like
DEFINE FONT oFntGross NAME "MS Sans Serif" SIZE 10,15 BOLD

Regards



G. N. Rao.

Hyderabad, India