FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour DRAW A TEXT ON A BITMAP
Posts: 222
Joined: Mon Jun 04, 2012 12:00 PM
DRAW A TEXT ON A BITMAP
Posted: Mon Jul 16, 2012 06:33 PM

i MADE :
n:=123

 hDC := aBtn[nBotone]:GETDC()
                    SetTextColor( hDC,CLR_YELLOW)
                    SetBkMode( hDC, 0 )
                     TextOut( hDC, 2, 4,str(n) )
                       aBtn[nBotone]:ReleaseDC()

but I see for a second the number n with yellow color and then it hide...why ?

Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: DRAW A TEXT ON A BITMAP
Posted: Mon Jul 16, 2012 07:42 PM


Code (fw): Select all Collapse
@ 12, 10 IMAGE oImage SIZE 180, 170 OF oDlg2  FILENAME NIL PIXEL SCROLL  
oImage:LoadImage( , c_path + "\Images\" + cWLogo )
oImage:lTransparent := .T. 
oImage:bPainted = { ||  SetBkMode( oImage:hDC, 1 ),; 
             SetTextColor( oImage:hDC, CLR_YELLOW ),; 
             TextOut( oImage:hDC, 50, 150, "Hello" ), ;
             TextOut( oImage:hDC, 80, 150, "World" ) }


Best Regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 222
Joined: Mon Jun 04, 2012 12:00 PM
Re: DRAW A TEXT ON A BITMAP
Posted: Mon Jul 16, 2012 07:48 PM

uwe, here crash
I use over 250 bitmaps...

Posts: 222
Joined: Mon Jun 04, 2012 12:00 PM
Re: DRAW A TEXT ON A BITMAP
Posted: Mon Jul 16, 2012 08:06 PM

WHEN i MAKE

@ nYnumero, nxnumero IMAGE aBtn[nBotone] SIZE BMP_H,BMP_V OF oPanel FILENAME NIL PIXEL NOBORDER
aBtn[nBotone]:LoadImage( , UMBRELLA_FREE )
aBtn[nBotone]:lTransparent := .T.

IT IS OK

WHEN i ADD THESE LINE IT CRASH AND NOT FOUND nBotone
aBtn[nBotone]:bPainted = { || SetBkMode( aBtn[nBotone]:hDC, 1 ),;
SetTextColor( aBtn[nBotone]:hDC, CLR_YELLOW ),;
TextOut( aBtn[nBotone]:hDC, 50, 150, str(n) ) }

Posts: 1088
Joined: Fri Oct 07, 2005 03:33 PM
Re: DRAW A TEXT ON A BITMAP
Posted: Mon Jul 16, 2012 09:55 PM

Silvio,

I think you need to take the DC of the BMP not from the BTN

regards

Marcelo

Posts: 222
Joined: Mon Jun 04, 2012 12:00 PM
Re: DRAW A TEXT ON A BITMAP
Posted: Mon Jul 16, 2012 10:56 PM

how?

Posts: 1088
Joined: Fri Oct 07, 2005 03:33 PM
Re: DRAW A TEXT ON A BITMAP
Posted: Tue Jul 17, 2012 12:45 AM

Silvio,

I don't sure, but you can probe using this

aBtn[nBotone]:hBitmap1:hDC or

hDC := getDC( aBtn[nBotone]:hBitmap1 )

regards

Marcelo

Posts: 222
Joined: Mon Jun 04, 2012 12:00 PM
Re: DRAW A TEXT ON A BITMAP
Posted: Tue Jul 17, 2012 06:14 AM

Not run

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: DRAW A TEXT ON A BITMAP
Posted: Tue Jul 17, 2012 08:56 AM

Silvio,

You have to use that code from aBtn[ n ]:bPainted := { || ... }

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 222
Joined: Mon Jun 04, 2012 12:00 PM
Re: DRAW A TEXT ON A BITMAP
Posted: Tue Jul 17, 2012 09:29 AM
Dear Antonio,

Many year ago I made beach application and I used the sbutton class of Mercado. It made some errors on the refreshing od dialog

I use on the dialog a Panel control where I show the umbrellas and the TScrWnd to scroll the beach .

Last year I tried with btnbmp class to show umbrellas of a beach and it run ok only for small beach

I tried it run on 50/60 umbrellas but I need over 800 /1200

First the procedure show right all umbrellas then when I make controls ( date range, insert numbers and control to reservations archive) the procedure EXE crash

I tried it also with 10 umbrellas : then the 75 th operation it crash ( with 200 umbrellas crash on 13 th operation)


then I tried with Image controls but it crash ( I cannot write the number on each umbrellas) but with many umbrellas it crash also


How I must make to show the umbrellas ?

Domenico tried also with no solution !!!!

I need to found a solution because a customer have 2500 umbrellas on his beach

have you a solution and a small test to try ?



Antonio, For your message : have you check the resources consume in your app ?

I no use resources I use only sources calls sample :

#define UMBRELLA_FREE ".\BITMAPS\FREE.BMP"
#define UMBRELLA_OCCUPATED ".\BITMAPS\OCCUPATED.BMP"
#define UMBRELLA_DAILY ".\BITMAPS\DAYBEACH.BMP"
#define UMBRELLA_NOTPAYED ".\BITMAPS\NOTPAYED.BMP"
#define UMBRELLA_RESERVATION ".\BITMAPS\RESERV.BMP"




sample of planning


Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: DRAW A TEXT ON A BITMAP
Posted: Tue Jul 17, 2012 09:34 AM

You may need to paint the umbrellas and not use a control for each one.

Keep an array in memory, with coordinates, situation, etc. of each umbrella.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 222
Joined: Mon Jun 04, 2012 12:00 PM
Re: DRAW A TEXT ON A BITMAP
Posted: Tue Jul 17, 2012 09:52 AM

the final user must change the color of bitmaps ( 1,2,3,4,5 )

can you make a small test sample to understand how I must make it please ?

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: DRAW A TEXT ON A BITMAP
Posted: Tue Jul 17, 2012 10:47 AM

Silvio,

Create a Class Umbrella:

CLASS Umbrella
DATA nTop, nLeft, nWidth, nHeight
DATA nStatus
etc...
METHOD paint() --> Here you paint a bitmap on its parent
METHOD IsOver( nRow, nCol ) // to detect a mouse click
ENDCLASS

as you see, it does not inherits from TControl. Then you keep an array of Umbrella objects.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 222
Joined: Mon Jun 04, 2012 12:00 PM
Re: DRAW A TEXT ON A BITMAP
Posted: Tue Jul 17, 2012 01:10 PM

and you think it can suopported many and many umbrellas ?

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: DRAW A TEXT ON A BITMAP
Posted: Tue Jul 17, 2012 03:57 PM

unlimited :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com