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: 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