Problem write text on Bitmaps resolved !!!

Problem write text on Bitmaps resolved !!!

Postby Silvio.Falconi » Tue Aug 21, 2018 7:30 pm

I wish draw a number into Bitmap

I saw Bmptext.prg sample but not run ok

Image

I create this small sample with 100 bmps and when I try to call bpainted method I not see any numbers ...why ?

Any Help please

the small test

Code: Select all  Expand view

#include "fivewin.ch"


#define BMP_H    40
#define BMP_V    40


static totx,toty
static ofont
static aData,aBmps

Function test()
   Local oDlg

nItem:= 1
TOTY := 10
TOTX := 10

aBmps := ARRAY( TOTY, TOTX )
aData := ARRAY( TOTY, TOTX )

DEFINE FONT ofont NAME "VERDANA" SIZE 0,-20 BOLD
Define Dialog oDlg size 600,600

Activate Dialog oDlg centered;
On Init Load(oDlg,TOTY,TOTX,aData,aBmps,nItem)
Return nil


//--------------------------------------------------------------------//
Function Load(oDlg,TOTY,TOTX,aData,aBmps,nItem)
  Local nY,nX

        For nY := 1 to TOTY
           For nX := 1 To TOTX
               aData[nY,nX] := "X"
               NExt nX
            Next nY

 AssegnaBitmaps( aBmps, aData, oDlg, nItem )

return nil
//-------------------------------------------------------------------//
Function AssegnaBitmaps( aBmps, aData, oDlg, nItem )
  Local nY, nX
  Local nRow:=60
  Local nCol:=BMP_V
  Local nFila:=1,x:=1
  Local t
  Local nNumber:= 1
 nY  := 1
 nX  := 1

 For nY := 1 to TOTY
 For nX := 1 To TOTX
        @ nrow, ncol  BITMAP aBmps[ nY, nX ] RESOURCE "VUOTO_48" OF oDlg ;
                SIZE  BMP_H, BMP_V PIXEL ADJUST     TRANSPARENT  //NOBORDER

  aBmps[nY,nX]:bPainted := { | hDC, cP, oBmp | Numbers_Painted(hDC,oBmp,oFont,nNumber)  }


  ncol:=ncol+BMP_V
  nNumber++
            Next nX

nRow += BMP_H
nCol := BMP_V
nNumber++
Next nY



RETUR NIL












Function Numbers_Painted(hDC,oBmp,oFont,n)

      DrawText2(hDC, oFont:hFont, 2,;
            ltrim(str(n)) + " " ,38, 3, 40, 62,CLR_WHITE,CLR_GREEN)

RETUR NIL
//-------------------------------------------------------------------//

FUNCTION DrawText2( hDC, hFont, nBkMode, cText, nTop, nLeft, nWidth, nHeight,color,color2 )
LOCAL hFontOld:= SelectObject( hDC, hFont )
LOCAL nBkOld := SetBkMode( hDC, nBkMode )
SetTextColor( hDC, color )
setBkColor( hDC, color2 )
DrawText( hDC, cText, { nTop, nLeft, nTop+nWidth, nLeft+nHeight } )
SelectObject( hDC, hFontOld )
SetBkMode( hDC, nBkOld )
RETURN( NIL
Last edited by Silvio.Falconi on Sat Aug 25, 2018 10:50 pm, edited 1 time in total.
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6897
Joined: Thu Oct 18, 2012 7:17 pm

Re: Problem write text on Bitmaps

Postby Silvio.Falconi » Wed Aug 22, 2018 11:25 am

any solution please ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6897
Joined: Thu Oct 18, 2012 7:17 pm

Re: Problem write text on Bitmaps

Postby Silvio.Falconi » Thu Aug 23, 2018 7:17 pm

I'm sure there is a solution plrase help me
Regards
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6897
Joined: Thu Oct 18, 2012 7:17 pm

Re: Problem write text on Bitmaps

Postby Lailton » Thu Aug 23, 2018 10:05 pm

Regards,
Lailton Fernando Mariano
User avatar
Lailton
 
Posts: 149
Joined: Fri Jul 20, 2012 1:49 am
Location: Brazil

Re: Problem write text on Bitmaps

Postby Silvio.Falconi » Fri Aug 24, 2018 8:25 am

Laiton,
These topics are for btnbmp not for bitmaps.
Then i tried it but not run
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6897
Joined: Thu Oct 18, 2012 7:17 pm

Re: Problem write text on Bitmaps resolved!!!

Postby Silvio.Falconi » Fri Aug 24, 2018 3:51 pm

resolved!!!

Image

But this function not run
Code: Select all  Expand view
FUNCTION DrawText2( hDC, hFont, nBkMode, cText, nTop, nLeft, nWidth, nHeight,color,color2 )
LOCAL hFontOld:= SelectObject( hDC, hFont )
LOCAL nBkOld := SetBkMode( hDC, nBkMode )
SetTextColor( hDC, color )
setBkColor( hDC, color2 )

DrawText( hDC, cText, { nTop, nLeft, nTop+nWidth, nLeft+nHeight } )
*DRAWTEXTEX( hDC,  cText, {  nTop, nLeft, nTop+nWidth, nLeft+nHeight  } )
SelectObject( hDC, hFontOld )
SetBkMode( hDC, nBkOld )
RETURN( NIL )
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6897
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 83 guests