Code: Select all
STATIC aGrad1, nTop1, nBottom1,aGrad2, nTop2, nBottom2
STATIC aGrad3, nTop3, nBottom3
FUNCTION MAIN()
LOCAL oWnd, aRect[4]
c_path := cFilePath(GetModuleFileName( GetInstance() ) )
c_path1 := c_path + "IMAGES\"
nColor2a := 14853684
nColor2b := 16312263
nMove2 := 0.50
lDirect2 := .T.
aGrad1 := { { 0.3, nColor2a, nColor2b }, { nMove2, nColor2b, nColor2a } }
aGrad2 := { { 0.3, nColor2a, 255 }, { nMove2, 255, nColor2a } }
//aGrad1 := { { 0.50, nRGB( 219, 230, 244 ), nRGB( 207, 221, 239 ) }, ;
// { 0.50, nRGB( 201, 217, 237 ), nRGB( 231, 242, 255 ) } }
//aGrad2 := { { 1, nRGB( 100, 200, 100 ), nRGB( 255, 230, 200 ) } }
aGrad3 := { { 0.1, 16744448, 16744448 }, { 0.1, 16744448, 16744448 } }
oFont1 := TFont():New("Arial", ,-30,.F.,.T. , , , ,.T. )
oFont2 := TFont():New("Arial", ,-24,.F.,.T. , , , ,.T. )
aRect[3] := GetSysmetrics( 1 ) - 25 // Screen-Height
aRect[4] := GetSysmetrics( 0 ) // Screen-Width
DEFINE WINDOW oWnd STYLE nOr( WS_POPUP, WS_VISIBLE )
ACTIVATE WINDOW oWnd ;
ON CLICK oWnd:End() ;
ON INIT ( oWnd:Move( 0, 0, aRect[4], aRect[3], .f. ) , ; // Top, left, width, height
W_BACKGRD( oWnd, "Backgrd.png", .F. ), SHOW_DLG( oWnd ) )
oFont1:End()
oFont2:End()
RETURN NIL
// ------------
FUNCTION SHOW_DLG( oWnd )
LOCAL oDlg, oBtn30, nRadio3 := 1, lCheck3 := .T.
LOCAL oSay3, oRadio3, oCheck3, oBrush5
LOCAL oSlide, oSlide1, oSlide2, oSlide3
LOCAL nVar1 := 150, nVar2 := 100, nVar3 := 150
DEFINE DIALOG oDlg FROM 50, 50 TO 500, 800 PIXEL ;
TITLE "Dialog GRADIENT"
@ 15, 15 SAY oSay3 PROMPT "Transparent Say" OF oDlg SIZE 150, 20 FONT oFont1 PIXEL
oSay3:SetColor( 255, )
oSay3:lTransparent := .T.
@ 50, 15 RADIO oRadio3 VAR nRadio3 OF oDlg PIXEL ;
ITEMS "Option &1", "Option &2" _3D SIZE 70, 20 COLOR 0 ; // 16443068 ;
HELPID 100, 101 ;
ON CHANGE MsgBeep()
oRadio3:SetFont( oFont1 )
AEval( oRadio3:aItems, { | oRad | oRad:lTransparent := .T. } )
@ 130, 15 CHECKBOX oCheck3 VAR lCheck3 COLOR 8454143 PIXEL ;
PROMPT "&ClickMe" OF oDlg SIZE 80, 15 ;
ON CHANGE oCheck3:SetText( "New Text" )
oCheck3:lTransparent := .T.
oCheck3:SetFont( oFont1 )
@ 190, 220 BTNBMP oBtn30 OF oDlg ;
SIZE 150 , 25 PROMPT "EXIT Gradient-test" 2007 ;
FONT oFont2 ;
LEFT ;
NOBORDER ;
FILENAME c_Path + "\Images\Close.bmp" ;
ACTION oDlg:End()
oBtn30:SetColor( 128, )
oBtn30:cTooltip := { "EXIT" + CRLF + ;
"Gradient-test","GRADIENT", CLR_BLACK, 14089979 }
ACTIVATE DIALOG oDlg ;
ON INIT GRADBRUSH(oDlg, aGrad1, 0, 200, ; // Top, Bottom
aGrad2, 200, 350, ; // Top, Bottom
aGrad3, 350, 500) // Top, Bottom
RETURN NIL
//--------------------------------------------
STATIC FUNCTION GRADBRUSH(oDlg, aGrad1, nTop1, nBottom1, ;
aGrad2, nTop2, nBottom2, ;
aGrad3, nTop3, nBottom3)
LOCAL hDC, oBrush, oImage
hDC = CreateCompatibleDC( oDlg:GetDC() )
hBmp = CreateCompatibleBitMap( oDlg:hDC, oDlg:nWidth, oDlg:nHeight )
hBmpOld = SelectObject( hDC, hBmp )
// 1. Gradient
GradientFill( hDC, nTop1, 0, nBottom1, oDlg:nWidth, aGrad1 )
// 2. Gradient
GradientFill( hDC, nTop2, 0, nBottom2, oDlg:nWidth, aGrad2 )
// Cokor
GradientFill( hDC, nTop3, 0, nBottom3, oDlg:nWidth, aGrad3 ) // Gradient created as COLOR
DeleteObject( oDlg:oBrush:hBrush )
oDlg:oBrush:hBitmap = hBmp
oDlg:oBrush:hBrush = CreatePatternBrush( hBmp )
SelectObject( hDC, hBmpOld )
oDlg:ReleaseDC()
RETURN( NIL )
// -------- WINDOW - Background ---------------
FUNCTION W_BACKGRD( oWnd, cImage, lAdjust )
LOCAL oBrush, oBrush1, hDC, oImage, aRect, lAlpha
IF FILE( c_path1 + cImage )
DEFINE IMAGE oImage FILE c_path1 + cImage
nIWidth := oImage:nWidth
nIHeight := oImage:nHeight
// Border = 15 added !!!
aRect := GETCLIENTRECT( oWnd:hWnd )
oBrush := TBrush():new( ,,,, ResizeBmp( oImage:hBitmap, aRect[4], aRect[3], .T. ) )
oWnd:SetBrush( oBrush )
oBrush:End()
oImage:End()
// stop windows-resize !!!
oWnd:aMinMaxInfo = { oWnd:nWidth, oWnd:nHeight ,; // xMaxSize, yMaxSize
oWnd:nTop, oWnd:nWidth ,; // xMaxPosition, yMaxPosition
oWnd:nWidth, oWnd:nHeight ,; // xMinTrackSize, yMinTrackSize
oWnd:nWidth, oWnd:nHeight } // xMaxTrackSize, yMaxTrackSize
ELSE
IF !EMPTY(cImage)
MsgAlert( "File : " + cImage + CRLF + ;
"does not exist" + CRLF + ;
"to show Image !", "ATTENTION" )
ENDIF
ENDIF
RETURN( NIL )