FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Problem write text on Bitmaps resolved !!!
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Problem write text on Bitmaps resolved !!!
Posted: Tue Aug 21, 2018 07:30 PM
I wish draw a number into Bitmap

I saw Bmptext.prg sample but not run ok



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 (fw): Select all Collapse
#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
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 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
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: Problem write text on Bitmaps
Posted: 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 March-April 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
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: Problem write text on Bitmaps
Posted: Thu Aug 23, 2018 07: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 March-April 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
Posts: 231
Joined: Fri Jul 20, 2012 01:49 AM
Re: Problem write text on Bitmaps
Posted: Thu Aug 23, 2018 10:05 PM
Regards,

Lailton Fernando Mariano
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: Problem write text on Bitmaps
Posted: Fri Aug 24, 2018 08: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 March-April 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
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: Problem write text on Bitmaps resolved!!!
Posted: Fri Aug 24, 2018 03:51 PM
resolved!!!



But this function not run
Code (fw): Select all Collapse
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 March-April 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

Continue the discussion