I have one Function to use < ABPaint( hDC, 20, 20, oBmp1:hBitmap, 220 ) >
to test on different backgrounds.
It works for brushes, colors, gradients without problems.
If I use a Image, < ABPaint > shows the image of the background with the
size of the Alpha-Bmp ( only in the function, not at start ).
- Code: Select all Expand view
FUNCTION NEW_WIN()
LOCAL oWnd1, oBtn1, oImage, oBmp1
cALPHA := ALLTRIM( W_C_ALPHA )
IF !EMPTY ( cALPHA )
DEFINE BITMAP oBmp1 FILENAME "&c_pfad\IMAGE\" + cALPHA
ENDIF
DEFINE WINDOW oWnd1 TITLE "Background for Windows"
@ 37, 150 BUTTONBMP oBtn1 OF oWnd1 ACTION oWnd1:End() ;
BITMAP "Quit" PROMPT " &Exit" TEXTRIGHT SIZE 100, 40 ;
MESSAGE "Quit"
oBtn1:cToolTip = { "Close" + CRLF + ;
"Windows","Close", 1, CLR_BLACK, 14089979 }
IF W_POS1 = 14 // Picture Background
cNEWLOGO := "&c_pfad\IMAGE\" + ALLTRIM(W_LOGO)
IF W_LOGOTYP = "B" // Brush
IF ! Empty( cNEWLOGO ) .and. File( "&cNEWLOGO" )
DEFINE BRUSH oImage FILE "&cNEWLOGO"
SET BRUSH OF oWnd1 TO oImage
ELSE
MsgAlert("No file selected !","Attention" )
ENDIF
ENDIF
ENDIF
IF W_LOGOTYP = "I" // Image
IF ! Empty( cNEWLOGO ) .and. File( "&cNEWLOGO" )
@ 0, 0 IMAGE oImage SIZE 150, 150 OF oWnd1 ADJUST
oImage:Progress( .f. )
oImage:LoadBmp( "&cNEWLOGO" )
ELSE
MsgAlert("No file selected !","Attention" )
ENDIF
ENDIF
ACTIVATE WINDOW oWnd1 MAXIMIZED ;
ON INIT NEW_COLOR1a(oWnd1) ;
ON PAINT ( IIF( W_STYLE = 1 .and. W_POS1 <= 10 , gradpaint1( hDC, oWnd1 ), NIL ), ;
IIF( W_POS1 > 10 .and. W_POS1 < 14, SHOW_WBRU( oWnd1 ), NIL ), ;
IIF(W_POS1 = 14, DRAWBITMAP( hDC, oImage:hbitmap, 0, 0,;
oWnd1:nWidth(), oWnd1:nHeight() ), NIL ),;
IIF( !EMPTY( W_C_ALPHA ), ;
ABPaint( hDC, W_T_ALPHA, W_L_ALPHA, oBmp1:hBitmap, 220 ), NIL ) )
RETURN NIL
If I do it on Start-Screen, it works fine.
- Code: Select all Expand view
FUNCTION MAIN()
...
...
DEFINE WINDOW oWnd TITLE "Background for Windows and Dialog"
// Background
// -------------
@ 0, 0 IMAGE oImage SIZE 150, 150 OF oWnd ADJUST
oImage:Progress( .f. )
oImage:LoadBmp( "BRAINSTORM.JPG" )
// Alpha-Bmp
// -------------
DEFINE BITMAP oBmp1 FILENAME "A_LOGO2.bmp"
...
...
ACTIVATE WINDOW oWnd MAXIMIZED ;
ON PAINT ( DRAWBITMAP( hdc, oImage:hbitmap, 0, 0,;
oWnd:nWidth(), oWnd:nHeight()), ;
ABPaint( hDC, 20, 20, oBmp1:hBitmap, 220 ) ) ;
VALID MsgYesNo( "Do you want to end?" )
RETURN NIL
I use the same syntax in MAIN and FUNCTION, but with different result.
With a small change, I got another result :
The small Background is still visible on Top/Left and the Alpha-Bmp is added.
I defined a extra hDC for the Alpha-Bmp but there is still another one running.
- Code: Select all Expand view
IIF( !EMPTY( W_C_ALPHA ), ;
( hDC := oBmp1:GETDC(), ABPaint( hDC, 50, 50, oBmp1:hBitmap, 220 ) ), NIL ) )
Regards
Uwe