DRAW A TEXT ON A BITMAP

User avatar
Eoeo
Posts: 222
Joined: Mon Jun 04, 2012 12:00 pm

DRAW A TEXT ON A BITMAP

Post by Eoeo »

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 ?
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Re: DRAW A TEXT ON A BITMAP

Post by ukoenig »

Image

Code: Select all

@ 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 :lol:
Last edited by ukoenig on Tue Jul 02, 2013 10:36 am, edited 1 time in total.
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.
User avatar
Eoeo
Posts: 222
Joined: Mon Jun 04, 2012 12:00 pm

Re: DRAW A TEXT ON A BITMAP

Post by Eoeo »

uwe, here crash
I use over 250 bitmaps...
User avatar
Eoeo
Posts: 222
Joined: Mon Jun 04, 2012 12:00 pm

Re: DRAW A TEXT ON A BITMAP

Post by Eoeo »

WHEN i MAKE

@ nY*numero, nx*numero 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) ) }
Marcelo Via Giglio
Posts: 1033
Joined: Fri Oct 07, 2005 3:33 pm
Location: Cochabamba - Bolivia

Re: DRAW A TEXT ON A BITMAP

Post by Marcelo Via Giglio »

Silvio,

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

regards

Marcelo
User avatar
Eoeo
Posts: 222
Joined: Mon Jun 04, 2012 12:00 pm

Re: DRAW A TEXT ON A BITMAP

Post by Eoeo »

how?
Marcelo Via Giglio
Posts: 1033
Joined: Fri Oct 07, 2005 3:33 pm
Location: Cochabamba - Bolivia

Re: DRAW A TEXT ON A BITMAP

Post by Marcelo Via Giglio »

Silvio,

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

aBtn[nBotone]:hBitmap1:hDC or

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

regards

Marcelo
User avatar
Eoeo
Posts: 222
Joined: Mon Jun 04, 2012 12:00 pm

Re: DRAW A TEXT ON A BITMAP

Post by Eoeo »

Not run
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: DRAW A TEXT ON A BITMAP

Post by Antonio Linares »

Silvio,

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

Antonio Linares
www.fivetechsoft.com
User avatar
Eoeo
Posts: 222
Joined: Mon Jun 04, 2012 12:00 pm

Re: DRAW A TEXT ON A BITMAP

Post by Eoeo »

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


Image
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: DRAW A TEXT ON A BITMAP

Post by Antonio Linares »

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
User avatar
Eoeo
Posts: 222
Joined: Mon Jun 04, 2012 12:00 pm

Re: DRAW A TEXT ON A BITMAP

Post by Eoeo »

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 ?
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: DRAW A TEXT ON A BITMAP

Post by Antonio Linares »

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
User avatar
Eoeo
Posts: 222
Joined: Mon Jun 04, 2012 12:00 pm

Re: DRAW A TEXT ON A BITMAP

Post by Eoeo »

and you think it can suopported many and many umbrellas ?
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: DRAW A TEXT ON A BITMAP

Post by Antonio Linares »

unlimited :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply