bmptxt

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

Pl try this code which works
Later on please make any other changes
Code: Select all  Expand view  RUN
#include "FiveWin.ch"

#define TRANSPARENT 1

static oWnd

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

function Main()

   local oBmp
   local oFntGross

    DEFINE FONT oFntGross NAME "VERDANA" SIZE 0,-20 BOLD

   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", oFntGross ) }

   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
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 6:00 pm

Perfect. Many thanks.
best regards,
Otto
User avatar
Otto
 
Posts: 6343
Joined: Fri Oct 07, 2005 7:07 pm

Postby nageswaragunupudi » Mon Jan 21, 2008 6:08 pm

Good.
Now about your code. ChooseFont returns array but not a font object.
That was the reason for your error.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10648
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Postby Enrico Maria Giordano » Mon Jan 21, 2008 6:41 pm

Otto wrote:Enrico,
I tried your suggestion but this does not work.


Sorry, I'm working too much...

Anyway, I've seen you already solved the problem.

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 7:05 pm

Using NageswaraRao's code and parts of yours from
" Saving and restoring a font. By Enrico Maria Giordano"
I put together a sample:

www.fwcodesnips.com

Thank you for your help,
Otto
User avatar
Otto
 
Posts: 6343
Joined: Fri Oct 07, 2005 7:07 pm

Postby nageswaragunupudi » Mon Jan 21, 2008 7:27 pm

Mr Otto

Nice. If you keep including interesting code from these forums on your site, it becomes easy for us to search when we want.

By the way you need to add some error checking in your code. The program fails when BuildFont function returns NIL.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10648
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

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