bmptxt

bmptxt

Postby Silvio » Sun Jan 20, 2008 8:49 am

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

Re: bmptxt

Postby Enrico Maria Giordano » Sun Jan 20, 2008 1:17 pm

I can't find that sample in latest FWH.

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

Postby Silvio » Mon Jan 21, 2008 9:48 am

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

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

Postby Enrico Maria Giordano » Mon Jan 21, 2008 11:11 am

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

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

Postby Otto » Mon Jan 21, 2008 11:13 am

I have one in my FWH 8.01 sample folder.
Size 558 03-04-1996
User avatar
Otto
 
Posts: 6343
Joined: Fri Oct 07, 2005 7:07 pm

Postby Enrico Maria Giordano » Mon Jan 21, 2008 11:39 am

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

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

Re: bmptxt

Postby Enrico Maria Giordano » 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
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Silvio » Mon Jan 21, 2008 12:11 pm

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

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


Postby Otto » Mon Jan 21, 2008 1: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

//----------------------------------------------------------------//
User avatar
Otto
 
Posts: 6343
Joined: Fri Oct 07, 2005 7:07 pm

Postby Silvio » Mon Jan 21, 2008 1:46 pm

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

bye
Best Regards, Saludos

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

Postby Otto » Mon Jan 21, 2008 4:00 pm

Silvio, could you provide a working sample.
Thanks in advance
Otto
User avatar
Otto
 
Posts: 6343
Joined: Fri Oct 07, 2005 7:07 pm

Postby nageswaragunupudi » Mon Jan 21, 2008 5:28 pm

Please try this
Code: Select all  Expand view  RUN
   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
nageswaragunupudi
 
Posts: 10648
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Postby Otto » Mon Jan 21, 2008 5: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
User avatar
Otto
 
Posts: 6343
Joined: Fri Oct 07, 2005 7:07 pm

Postby nageswaragunupudi » Mon Jan 21, 2008 5: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
User avatar
nageswaragunupudi
 
Posts: 10648
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 26 guests