DRAW A TEXT ON A BITMAP
DRAW A TEXT ON A BITMAP
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 ?
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 ?
Re: DRAW A TEXT ON A BITMAP
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" ) }
Uwe
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.
i work with FW.
If you have any questions about special functions, maybe i can help.
Re: DRAW A TEXT ON A BITMAP
uwe, here crash
I use over 250 bitmaps...
I use over 250 bitmaps...
Re: DRAW A TEXT ON A BITMAP
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) ) }
@ 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) ) }
-
- Posts: 1033
- Joined: Fri Oct 07, 2005 3:33 pm
- Location: Cochabamba - Bolivia
Re: DRAW A TEXT ON A BITMAP
Silvio,
I think you need to take the DC of the BMP not from the BTN
regards
Marcelo
I think you need to take the DC of the BMP not from the BTN
regards
Marcelo
-
- Posts: 1033
- Joined: Fri Oct 07, 2005 3:33 pm
- Location: Cochabamba - Bolivia
Re: DRAW A TEXT ON A BITMAP
Silvio,
I don't sure, but you can probe using this
aBtn[nBotone]:hBitmap1:hDC or
hDC := getDC( aBtn[nBotone]:hBitmap1 )
regards
Marcelo
I don't sure, but you can probe using this
aBtn[nBotone]:hBitmap1:hDC or
hDC := getDC( aBtn[nBotone]:hBitmap1 )
regards
Marcelo
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: DRAW A TEXT ON A BITMAP
Silvio,
You have to use that code from aBtn[ n ]:bPainted := { || ... }
You have to use that code from aBtn[ n ]:bPainted := { || ... }
Re: DRAW A TEXT ON A BITMAP
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
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
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: DRAW A TEXT ON A BITMAP
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.
Keep an array in memory, with coordinates, situation, etc. of each umbrella.
Re: DRAW A TEXT ON A BITMAP
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 ?
can you make a small test sample to understand how I must make it please ?
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: DRAW A TEXT ON A BITMAP
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.
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.
Re: DRAW A TEXT ON A BITMAP
and you think it can suopported many and many umbrellas ?
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact: