using PalBmpDraw with Quality-setting I noticed, it works reverse using BMP-Image-Format.
is it possible, to include a Formatdetection inside the Class ?
For the Moment, I have to check the extension before using < PalBmpDraw >.
IF cFileExt( cFileName ) = "BMP"
...
...
BMP with reduced Quality using ,, .T.
PalBmpDraw( hDC, 0, 0, oImage:hBitmap, , oBitmap:nWidth, oBitmap:nHeight ), , .T. ) !!! only for non BMP
( used as well for the JPG-Image-selection, to change a Bitmap from Resource )
PalBmpDraw( hDC, 0, 0, oImage:hBitmap, , oBitmap:nWidth, oBitmap:nHeight ) // used for BMP
- Code: Select all Expand view
// --------- Brush --------------------
REDEFINE BITMAP oBMP1 ID 120 ADJUST RESOURCE "Blanc" OF oDlg1
oBMP1:bPainted := {|hDC| BMP_BRUSH( oBMP1, hDC, cSBRUSH[nOBJECT] ) }
// --------- Image -------------------
REDEFINE BITMAP oBMP2 ID 220 ADJUST RESOURCE "Blanc" OF oDlg1
oBMP2:bPainted := {|hDC| BMP_IMAGE( oBMP2, hDC, cSIMAGE[nOBJECT]) }
// ---------- BMP BRUSH ( adjusted ) --------------
FUNCTION BMP_BRUSH( oBitmap, hDC, cBitmap )
LOCAL oImage
IF FILE( c_path + "\Images\" + cBitmap )
DEFINE IMAGE oImage FILENAME c_path + "\Images\" + cBitmap
// Formattest needed !!!!
// ---------------------------
IF cFileExt ( cBitmap ) = "BMP"
PalBmpDraw( hDC, 0, 0, oImage:hBitmap, , oBitmap:nWidth, oBitmap:nHeight )
ELSE
PalBmpDraw( hDC, 0, 0, oImage:hBitmap, , oBitmap:nWidth, oBitmap:nHeight, , .T. )
ENDIF
DeleteObject( oImage )
ELSE
MsgAlert( "File : " + CRLF + ;
c_path + "\Images\" + cBitmap + CRLF + ;
"not found !", "ATTENTION" )
ENDIF
RETURN( NIL )
Best regards
Uwe