DRAW A TEXT ON A BITMAP

DRAW A TEXT ON A BITMAP

Postby Eoeo » Mon Jul 16, 2012 6: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 ?
User avatar
Eoeo
 
Posts: 222
Joined: Mon Jun 04, 2012 12:00 pm

Re: DRAW A TEXT ON A BITMAP

Postby ukoenig » Mon Jul 16, 2012 7:42 pm

Image

Code: Select all  Expand view

@ 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
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: DRAW A TEXT ON A BITMAP

Postby Eoeo » Mon Jul 16, 2012 7:48 pm

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

Postby Eoeo » Mon Jul 16, 2012 8:06 pm

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

Re: DRAW A TEXT ON A BITMAP

Postby Marcelo Via Giglio » Mon Jul 16, 2012 9:55 pm

Silvio,

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

regards

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

Re: DRAW A TEXT ON A BITMAP

Postby Eoeo » Mon Jul 16, 2012 10:56 pm

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

Re: DRAW A TEXT ON A BITMAP

Postby Marcelo Via Giglio » 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
Marcelo Via Giglio
 
Posts: 1064
Joined: Fri Oct 07, 2005 3:33 pm
Location: Cochabamba - Bolivia

Re: DRAW A TEXT ON A BITMAP

Postby Eoeo » Tue Jul 17, 2012 6:14 am

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

Re: DRAW A TEXT ON A BITMAP

Postby Antonio Linares » Tue Jul 17, 2012 8:56 am

Silvio,

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

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: DRAW A TEXT ON A BITMAP

Postby Eoeo » Tue Jul 17, 2012 9: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


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

Re: DRAW A TEXT ON A BITMAP

Postby Antonio Linares » Tue Jul 17, 2012 9: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: DRAW A TEXT ON A BITMAP

Postby Eoeo » Tue Jul 17, 2012 9: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 ?
User avatar
Eoeo
 
Posts: 222
Joined: Mon Jun 04, 2012 12:00 pm

Re: DRAW A TEXT ON A BITMAP

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

Re: DRAW A TEXT ON A BITMAP

Postby Eoeo » Tue Jul 17, 2012 1:10 pm

and you think it can suopported many and many umbrellas ?
User avatar
Eoeo
 
Posts: 222
Joined: Mon Jun 04, 2012 12:00 pm

Re: DRAW A TEXT ON A BITMAP

Postby Antonio Linares » Tue Jul 17, 2012 3:57 pm

unlimited :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 52 guests