I'd like to draw a transparent bmp from resource on one of my dialogs. The dialog is already being painted with a gradient. This is my code:
- Code: Select all Expand view
...
ADD GROUP oG1 RIBBON oApp():oRibbon TO OPTION 1 PROMPT "Information" width 105
@ 08, 05 ADD BUTTON b1 GROUP oG1 BITMAP "Chart32" SIZE 40, 40 MOSTLEFT ROUND
b1:cToolTip := "Status Charts"
@ 08, 55 ADD BUTTON b1 GROUP oG1 BITMAP "News32" SIZE 40, 40 MOSTLEFT ROUND
b1:cToolTip := "News"
DEFINE DIALOG ::oDlg RESOURCE "presentation" TRANSPARENT
REDEFINE BITMAP oBmp RESOURCE "MAIN_LOGO" ID 1 OF ::oDlg TRANSPARENT
ACTIVATE DIALOG ::oDlg NOWAIT VALID ( oSelf:hide(), .F. ) ;
ON INIT ( oSelf:hide(), oBmp:hide() );
ON PAINT DlgPaint( hDC, oSelf:oDlg, oBmp )
...
*------------------------------------------------------------------------------
FUNCTION DlgPaint( hDC, oDlg, oBmp, aGrad )
LOCAL hBrush, aRect := GetClientRect( oDlg:hWnd )
DEFAULT aGrad := { { 1.0, nRGB( 75, 144, 223 ), nRGB( 41, 85, 145 ) } }
hBrush := GradientBrush( hDC, 0, 0, aRect[ 4 ] - aRect[ 2 ] + 1,;
aRect[ 3 ] - aRect[ 1 ] + 1,;
aGrad, .t. )
FillRect( hDC, aRect, hBrush )
DeleteObject( hBrush )
IF oBmp != NIL
PalBmpDraw( hDc, ( oDlg:nHeight() / 2 ) - ( oBmp:nHeight() / 2 ),;
( oDlg:nWidth() / 2 ) - ( oBmp:nWidth() / 2 ),;
oBmp:hBitmap, oBmp:hPalette,,,,.T.,oDlg:nClrPane)
oBmp:End()
ENDIF
RETURN NIL
This is the dlg on the resource:
- Code: Select all Expand view
- PRESENTATION DIALOG 0, 0, 105, 0
STYLE DS_3DLOOK |DS_SETFONT |WS_CHILD
FONT 8, "MS Sans Serif"
LANGUAGE LANG_NEUTRAL, 0
BEGIN
CONTROL "TBitMap",1,"TBitMap",WS_CHILD |WS_VISIBLE ,1,8,347,94
END
The bmp is drawn allright, but not transparent. I don't know how to make it transparent. Here is how it looks:
Can someone help?
Reinaldo.