#include "FiveWin.ch"
#include "Image.ch"
STATIC hDC, oFont, nDStyle
// ------- DIALOG from Code ---------------
FUNCTION Main()
LOCAL nSWidth := GetSysMetrics(0), nSHeight := GetSysMetrics(1)
local oDlg1, oGrp1, oGet
LOCAL cVar := SPACE( 30 )
oFont := TFont():New("Arial",0,-14,.F.,.T.,0,0,0,.T. )
SET _3DLOOK ON
SetBalloon( .T. )
c_path := GETCURDIR()
nDStyle := 1
DEFINE DIALOG oDlg1 FROM 30, 30 TO 380, 500 PIXEL ;
FONT oFont TITLE "DIALOG from Code" TRANSPARENT
oDlg1:nStyle = NOR( oDlg1:nStyle, WS_CLIPCHILDREN, WS_THICKFRAME )
@ 3, 3 GET cVar
D_BACKGRD( oDlg1, nDStyle, 16642248, 15714367, .F., 0.2, "BluStone.Bmp", "PICTURE9.jpg" )
ACTIVATE DIALOG oDlg1 ;
ON INIT ( oDlg1:Move( 60, 30, oDlg1:nWidth, oDlg1:nHeight, .f. ) ) ;
ON PAINT ( SHOW_GROUP( oDlg1 ) )
oFont:End()
RETURN NIL
// ------------------------
FUNCTION SHOW_GROUP( oDlg1 )
LOCAL oGrp1
@ 20, 20 GROUP oGrp1 TO 210, 350 PIXEL ;
PROMPT "Group" OF oDlg1
oGrp1:oFont := oFont
oGrp1:SetColor( 0, )
oGrp1:lTransparent := .T.
TEST( oGrp1:GETDC() )
RETURN( NIL )
// -------------------
STATIC FUNCTION TEST( hDC )
WNDBOX( hDC, 150, 220, 300, 400 )
RETURN NIL
// -------- DIALOG - Background ---------------
FUNCTION D_BACKGRD( oDlg, nStyle, nColor1, nColor2, lDirect, nMove, cBrush, cImage)
Local oBrush
IF nStyle = 1
DEFINE BRUSH oBrush COLOR nColor1
ENDIF
IF nStyle = 2
aGrad := { { nMove, nColor1, nColor2 }, { nMove, nColor2, nColor1 } }
hDC = CreateCompatibleDC( oDlg:GetDC() )
// Get Width and Height from INIT !!!
hBmp = CreateCompatibleBitMap( oDlg:hDC, 470, 350 )
hBmpOld = SelectObject( hDC, hBmp )
GradientFill( hDC, 0, 0, 350, 470, aGrad, lDirect )
DeleteObject( oDlg:oBrush:hBrush )
oBrush := TBrush():New( ,,,, hBmp )
oBrush:Cargo := aGrad
SelectObject( hDC, hBmpOld )
ReleaseDC(hDC)
ENDIF
IF nStyle = 3
DEFINE BRUSH oBrush FILE c_path + "\Images\" + cBrush
ENDIF
IF nStyle = 4
DEFINE IMAGE oImage FILE c_path + "\Images\" + cImage
// Get Width and Height from INIT !!!
oBrush := TBrush():new( ,,,, ResizeBmp( oImage:hBitmap, 470, 350, .T. ) )
oImage:End()
ENDIF
oDlg:SetBrush( oBrush )
oBrush:End()
RETURN( NIL )