Page 1 of 2
bmptxt
Posted: Sun Jan 20, 2008 8:49 am
by Silvio
I saw bmptxt.prg sample
Howe I can modify the font to insert a big text ?
Re: bmptxt
Posted: Sun Jan 20, 2008 1:17 pm
by Enrico Maria Giordano
I can't find that sample in latest FWH.
EMG
Posted: Mon Jan 21, 2008 9:48 am
by Silvio
you must see well !!
CMq I revolve i thanks
Posted: Mon Jan 21, 2008 11:11 am
by Enrico Maria Giordano
I confirm: a file called bmptxt.prg doesn't exists in FWH.
EMG
Posted: Mon Jan 21, 2008 11:13 am
by Otto
I have one in my FWH 8.01 sample folder.
Size 558 03-04-1996
Posted: Mon Jan 21, 2008 11:39 am
by Enrico Maria Giordano
Its name is bmptext.prg not bmptxt.prg. That's why I did not find it.
EMG
Re: bmptxt
Posted: Mon Jan 21, 2008 11:41 am
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
Posted: Mon Jan 21, 2008 12:11 pm
by Silvio
Quanto la fai difficile : ti ho detto che ho risolto..!!!
Posted: Mon Jan 21, 2008 1:36 pm
by Enrico Maria Giordano
Sorry.
EMG
Posted: Mon Jan 21, 2008 1:38 pm
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
//----------------------------------------------------------------//
Posted: Mon Jan 21, 2008 1:46 pm
by Silvio
NO you must this
holdfnt:=selectobject( hdc,ofont:hfont)
and the you can use texout
bye
Posted: Mon Jan 21, 2008 4:00 pm
by Otto
Silvio, could you provide a working sample.
Thanks in advance
Otto
Posted: Mon Jan 21, 2008 5:28 pm
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
Posted: Mon Jan 21, 2008 5:50 pm
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
Posted: Mon Jan 21, 2008 5:54 pm
by nageswaragunupudi
Mr Otto
First try with defining the font. like
DEFINE FONT oFntGross NAME "MS Sans Serif" SIZE 10,15 BOLD