by oliveiros junior » Fri Apr 19, 2024 1:42 pm
Good morning!
I'm going to post here the two codes I made as an example (the second is used here on the forum), in the first the background image is the way I need it, taking up 3/4 of the screen, but the second image is not transparent. In the second, the image occupies the entire screen and the image becomes transparent.
Att.,
Oliveiros Junior
/*-------------------------------------------------------------------------------
Sample 1
-------------------------------------------------------------------------------*/
#include "FiveWin.ch"
*-------------------------------------------------------------------------------*
Function Main()
Local oDlg, oImagem
Local cImagem := "..\bitmaps\pngs\2.png"
DEFINE DIALOG oDlg SIZE 800, 600 ;
STYLE nOr( WS_CHILD, WS_POPUP ) ;
COLOR CLR_BLACK, CLR_BLACK TRUEPIXEL
SetDlgGradient( { { 0.7, CLR_WHITE, CLR_WHITE }, ;
{ 0.3, CLR_BLACK, CLR_BLACK }, .F. } )
@ 0, 0 BITMAP oImagem FILENAME cImagem ;
SIZE 400, 600 OF ;
oDlg PIXEL NO BORDER ADJUST
ACTIVATE WINDOW oDlg CENTERED ;
ON INIT SobreporImagem( oDlg )
Return NIL
*------------------------------------------------------------------------------*
Function SobreporImagem( oDlg )
Local oImagem
Local cImagem := "..\bitmaps\pngs\home.png"
@ 0, 0 XIMAGE oImagem FILENAME cImagem ;
SIZE 200, 200 OF ;
oDlg NO BORDER
Return NIL
*------------------------------------------------------------------------------*
/*-------------------------------------------------------------------------------
Sample 2
-------------------------------------------------------------------------------*/
#include "FiveWin.ch"
*-------------------------------------------------------------------------------*
Function Main()
Local oDlg, oBitmap
Local cImagem := "..\bitmaps\pngs\home.png"
DEFINE DIALOG oDlg SIZE 800, 600 ;
STYLE nOr( WS_CHILD, WS_POPUP ) ;
COLOR CLR_BLACK, CLR_BLACK TRUEPIXEL
SetDlgGradient( { { 0.7, CLR_BLACK, CLR_BLACK }, ;
{ 0.3, CLR_WHITE, CLR_WHITE }, .F. } )
@ 0, 0 BITMAP oBitmap FILENAME cImagem ;
SIZE 200, 200 OF ;
oDlg NO BORDER
ACTIVATE WINDOW oDlg CENTERED ;
ON INIT SobreporImagem( oDlg )
Return NIL
*------------------------------------------------------------------------------*
Function SobreporImagem( oDlg )
Local oImagem, oBrush
Local cImagem := "..\bitmaps\pngs\2.png"
DEFINE IMAGE oImagem FILENAME cImagem
oBrush := TBrush():new( ,,,, ResizeBmp( oImagem:hBitmap, 600, 600, .T. ) )
oImagem:End()
oDlg:SetBrush( oBrush )
oBrush:End()
Return NIL
*----------------------------------------------------------------------------------*