bmptxt

User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

bmptxt

Post by Silvio »

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

Falconi Silvio
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Post by Silvio »

you must see well !!
CMq I revolve i thanks
Best Regards, Saludos

Falconi Silvio
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Post by Otto »

I have one in my FWH 8.01 sample folder.
Size 558 03-04-1996
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post by Enrico Maria Giordano »

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

EMG
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: bmptxt

Post by Enrico Maria Giordano »

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
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Post by Silvio »

Quanto la fai difficile : ti ho detto che ho risolto..!!!
Best Regards, Saludos

Falconi Silvio
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Post by Otto »

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

//----------------------------------------------------------------//
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Post by Silvio »

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

bye
Best Regards, Saludos

Falconi Silvio
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Post by Otto »

Silvio, could you provide a working sample.
Thanks in advance
Otto
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Post by nageswaragunupudi »

Please try this

Code: Select all

   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
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Post by Otto »

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
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Post by nageswaragunupudi »

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
Post Reply