BMP-Replace in Tile-Style ( maybe some Informations to help ) :
A given BMP replaced with others in Tile-Style :
// The Resource :
REDEFINE BITMAP oBMP4 ID 340 ADJUST RESOURCE "Blanc" OF oDlg // any Resource will be replaced with new BMP
oBMP4:bPainted := {|hDC| DRAW_BTILE( oBMP4, hDC, oTextfont, c_path + "\images\USER.BMP", ;
"Text-Test", 0, 16777215 ) }
// ---------- Bitmap -TILED with Text if needed on a BMP-resource --------------
FUNCTION DRAW_BTILE( oBitmap, hDC, oTextfont, cBitmap, cTitle, nLeft, nTColor )
LOCAL oImage, nRow := 0, nCol := 0, n
IF FILE( cBitmap )
DEFINE BITMAP oImage FILENAME cBitmap
aRect := GETCLIENTRECT( oBitmap:hWnd )
nHeight := oImage:nHeight
nWidth := oImage:nWidth
IF aRect[3] > 0
DO WHILE nRow < aRect[3]
nCol = 0
DO WHILE nCol < aRect[4]
PalBmpDraw( hDC, nRow, nCol, oImage:hBitmap ) // oBitmap:GETDC()
nCol += nHeight
ENDDO
nRow += nWidth
ENDDO
ELSE
MsgAlert( "Not possible to use Picture " + CRLF + ;
cBitmap + CRLF + ;
"for TILED-selection !", "ATTENTION" )
ENDIF
// Part : Text define
// ---------------------
hOldFont := SelectObject( hDC, oTextFont:hFont )
nTXTLG := GettextWidth( hDC, cTitle )
nBMPLONG := oBitmap:Super:nWidth()
nBMPHIGHT := oBitmap:Super:nHeight()
nFONTHIGHT := oTextFont:nInpHeight * -1
IF nLEFT = 0
nLEFT := (nBMPLONG - nTXTLG) / 2
ENDIF
nNEWHIGHT := nFONTHIGHT
nTOP := (nBMPHIGHT - nNEWHIGHT) / 2
SetTextColor( hDC,nTColor)
SetBkMode( oBitmap:hDC, 0 )
TextOut( hDC, nTOP, nLEFT, cTitle )
oBitmap:ReleaseDC()
ELSE
IF !EMPTY(cBitmap)
MsgAlert( "File : " + cBitmap + CRLF + ;
"does not exist" + CRLF + ;
"to create Background !", "ATTENTION" )
ENDIF
ENDIF
RETURN( NIL )
Best Regards
Uwe
