// C:\FWH..\SAMPLES\PROJECT.PRG
// original:
// viewtopic.php?f=3&t=18167&p=111528&hilit=aGradSel&sid=76f47b766de9c18f4bf4beffea25c135#p111528
#Include "Fivewin.ch"
STATIC hDC, oWndMain, oFont1
STATIC c_path
FUNCTION Main()
LOCAL oBar, aColors1, aColors2, aColors3, oAlpha
LOCAL oBtn1, oBtn2, oBtn3, oBtn4
LOCAL oTmp, oBrush1, oBrush2, oBrush3, oBrush4
LOCAL aRect3 := GetSysmetrics( 1 ) // Screen-Height
LOCAL aRect4 := GetSysmetrics( 0 ) // Screen-Width
// c_path := CURDRIVE() + ":\" + GETCURDIR() // five antiguo
c_path := GETCURDIR()
oFont1 := TFont():New( "Arial", 0, - 14, .F., .T., 0, 0, 0, .T., .F. )
// ? c_path
SetBalloon( .T. )
SkinButtons()
// ---- MDI - FRAME -----------
DEFINE IMAGE oTmp FILENAME "..\bitmaps\Back.bmp"
DEFINE BRUSH oBrush1 FILE "..\bitmaps\sea.bmp" RESIZE
DEFINE WINDOW oWndMain FROM 0, 0 TO aRect3, aRect4 ;
TITLE "Window - and Dialog-test" BRUSH oBrush1 PIXEL
oWndMain:SetFont( oFont1 )
DEFINE BITMAP oAlpha FILENAME "..\bitmaps\Logo.bmp"
SET MESSAGE OF oWndMain TO FWVERSION + " TechData Software " ;
CENTERED 2007
ACTIVATE WINDOW oWndMain MAXIMIZED ;
ON INIT MDI_DIALOG() ;
ON PAINT ABPaint( hDC, 30, 380, oAlpha:hBitmap, 255 ) // Horiz / Vertical
oFont1:End()
oBrush1:End()
oTmp:End()
RETURN NIL
// --------- DIALOG ----------
FUNCTION MDI_DIALOG()
LOCAL oWndDlg, oFld, hDC, oBtn1, oTmp, oBrush3, nTabPos
LOCAL oSay1, oSay2, oRadio1, oRadio2, oCheck1, oCheck2
LOCAL nRadio1 := 1, nRadio2 := 1, lCheck1 := .T., lCheck2 := .T.
LOCAL aGradSel, aGradUnSel, aGradOverUnSel, aGradOver, aGradDis
LOCAL aS, aUS, aOU, aO, aD
DEFINE IMAGE oTmp FILENAME "..\bitmaps\Back1.jpg"
DEFINE BRUSH oBrush3 FILE "..\bitmaps\sea.bmp" RESIZE
DEFINE DIALOG oWndDlg FROM 100, 180 TO 580, 880 OF oWndMain PIXEL ;
TRANSPARENT TITLE "Dialog-Test" BRUSH oBrush3
oWndDlg:lHelpIcon := .F.
// error
//oBrush3 := TBrush():new( ,,,, ResizeBmp( oTmp:hBitmap, 700, 480, .T. ) )
//oWndDlg:Setbrush( oBrush3 )
@ 65, 20 SAY oSay1 PROMPT "Transparent Say" OF oWndDlg SIZE 80, 20 ;
FONT oFont1 PIXEL UPDATE
oSay1:SetColor( 65535, )
oSay1:lTransparent := .T.
@ 85, 15 RADIO oRadio1 VAR nRadio1 OF oWndDlg PIXEL ;
ITEMS "Option &1", "Option &2" _3D SIZE 70, 16 COLOR 65535 ;
HELPID 100, 101 ON CHANGE MsgBeep()
oRadio1:SetFont( oFont1 )
AEval( oRadio1:aItems, {| oRad | oRad:lTransparent := .T. } )
@ 130, 20 CHECKBOX oCheck1 VAR lCheck1 COLOR 65535 PIXEL ;
PROMPT "&Checkbox" OF oWndDlg SIZE 70, 15 ;
ON CHANGE oCheck1:SetText( "New Text" )
oCheck1:lTransparent := .T.
oCheck1:SetFont( oFont1 )
@ 68, 130 FOLDEREX oFld OF oWndDlg PIXEL SIZE 200, 120 ;
PROMPT "T&est", "&Tabs", "&Bmp", "Br&ush" ;
BITMAPS "..\bitmaps\16Edit.bmp", ;
"..\bitmaps\16Edit.bmp", ;
"..\bitmaps\16Edit.bmp", ;
"..\bitmaps\16Edit.bmp" ;
ROUND 5 ;
ON CHANGE ( nTabPos := 1 )
oFld:lTransparent := .T.
oFld:nFolderHeight := 25
oFld:nSeparator := 5
oFld:bClrText := {| o, n | 65535 }
oFld:oFont := oFont1
// aGradSel, aGradUnSel, aGradOverUnSel, aGradOver, aGradDis
aS := { { 1, 128, 16777215 } }
aUS := { { 1, 8388608, 16777215 } }
aOU := { { 1, 32768, 16777215 } }
aO := { { 1, 0, 16777215 } }
aD := { { 1, 12566463, 16777215 } }
// .or.
/*
aGradSel := { { 0.5, nRGB( 150, 215, 0 ), nRGB( 100, 173, 0 ) },;
{ 0.75, nRGB( 150, 255, 255 ), nRGB( 150, 255, 255 ) } }
aGradUnSel := { { 0.5, nRGB( 255, 255, 255 ), nRGB( 240, 240, 240 ) },;
{ 0.5, nRGB( 240, 240, 240 ), nRGB( 200, 200, 200 ) } }
aGradOverUnSel := { { 0.25, nRGB( 100, 149, 237 ), nRGB( 100, 149, 237 ) },;
{ 0.75, nRGB( 255, 255, 255 ), nRGB( 200, 200, 200 ) } }
aGradOver := { { 0.5, nRGB( 200, 200, 200), nRGB( 240, 240, 240 ) },;
{ 0.5, nRGB( 240, 240, 240 ), nRGB( 255, 255, 255 ) } }
aGradDis := { { 1, nRGB( 211, 211, 211 ), nRGB( 190, 190, 190) } }
aS := aGradSel
aUS := aGradUnSel
aOU := aGradOverUnSel
aO := aGradOver
aD := aGradDis
*/
oFld:SetDefColors( aS, aUS, aOU, aO, aD )
oFld:bClrTabs := {| o, n | oFld:SetFldColors( o, n ) }
@ 15, 20 SAY oSay2 PROMPT "Transparent Say" OF oFld:aDialogs[ 1 ] ;
SIZE 80, 20 FONT oFont1 PIXEL UPDATE
oSay2:SetColor( 65535, )
oSay2:lTransparent := .T.
@ 35, 15 RADIO oRadio2 VAR nRadio2 OF oFld:aDialogs[ 1 ] PIXEL ;
ITEMS "Option &1", "Option &2" _3D SIZE 70, 16 COLOR 65535 ;
HELPID 100, 101 ;
ON CHANGE MsgBeep()
oRadio1:SetFont( oFont1 )
AEval( oRadio1:aItems, {| oRad | oRad:lTransparent := .T. } )
@ 80, 20 CHECKBOX oCheck1 VAR lCheck1 COLOR 65535 PIXEL ;
PROMPT "&Checkbox" OF oFld:aDialogs[ 1 ] SIZE 70, 15 ;
ON CHANGE oCheck1:SetText( "New Text" )
oCheck1:lTransparent := .T.
oCheck1:SetFont( oFont1 )
@ 200, 250 BTNBMP oBtn1 OF oWndDlg ;
SIZE 75, 35 PROMPT "Exit" 2007 ;
FONT oFont1 ;
TOP ;
NOBORDER ;
FILENAME "..\bitmaps\Exit.bmp" ;
ACTION oWndMain:End()
oBtn1:SetColor( 128, )
oBtn1:cTooltip := { "Close" + CRLF + ;
"MDI-test", "Exit", 1, CLR_BLACK, 14089979 }
ACTIVATE DIALOG oWndDlg NOWAIT ;
ON INIT ( SHOW_BAR( oWndDlg ), oFld:SetOption( 2 ) ) ;
ON PAINT F_BACKGRD( 3, oFld, hDC, 0.50, 14853684, 16312263, .T., "..\Back1.bmp", "..\Back1.jpg" )
oBrush3:End()
oTmp:End()
RETURN NIL
FUNCTION SHOW_BAR( oWndDlg )
LOCAL oBar, oBarButt1, oBarButt2, oBarButt3
DEFINE BUTTONBAR oBar SIZE 100, 50 _3D OF oWndDlg 2007
DEFINE BUTTON oBarButt1 OF oBar FILE "..\bitmaps\Exit.bmp" LEFT NOBORDER ;
PROMPT " &Exit " TOOLTIP "Preview" FONT oFont1 ;
ACTION MsgAlert( "Bartest", "Attention" )
oBarButt1:SetSize( 100, 50, .T. )
oBarButt1:Refresh()
DEFINE BUTTON oBarButt2 OF oBar FILE "..\bitmaps\Preview.bmp" LEFT NOBORDER ;
PROMPT " &Preview " TOOLTIP "Exit BarPainter" FONT oFont1 ;
ACTION MsgAlert( "Bartest", "Attention" )
oBarButt2:SetSize( 120, 50, .T. )
oBarButt2:Refresh()
RETURN NIL
FUNCTION NEW_BRUSH( oWndDlg )
LOCAL hDC1, aColors, hBmp, hBmpOld
aColors := { { 0.50, 14853684, 16312263 }, { 0.50, 16312263, 14853684 } }
hDC1 = CreateCompatibleDC( oWndDlg:GetDC() )
hBmp = CreateCompatibleBitMap( oWndDlg:hDC, oWndDlg:nWidth(), oWndDlg:nHeight() - 25 )
hBmpOld = SelectObject( hDC1, hBmp )
GradientFill( hDC1, 0, 0, oWndDlg:nHeight(), oWndDlg:nWidth(), aColors, .T. )
DeleteObject( oWndDlg:oBrush:hBrush )
oWndDlg:oBrush:hBitmap = hBmp
oWndDlg:oBrush:hBrush = CreatePatternBrush( hBmp )
SelectObject( hDC1, hBmpOld )
oWndDlg:ReleaseDC()
oWndDlg:Refresh()
RETURN NIL
FUNCTION PaintTab( o, nOption )
LOCAL hBrush, hBmp, nLastRow
IF nOption == o:nOver .OR. nOption == o:nOption
o:SetAlphaLevel( nOption, 255 )
ELSE
o:SetAlphaLevel( nOption, 50 )
ENDIF
IF nOption == o:nOption .AND. nOption == 3
hBmp = ReadBitmap( 0, "..\bitmaps\Marble.bmp" )
hBrush = CreatePatternBrush( hBmp )
DeleteObject( hBmp )
IF o:nLayOut == 2
nLastRow = o:aPos[ o:aLines[ o:aOrder[ 1 ] ][ 1 ] ][ 1 ] + o:nFolderHeight
SetBrushOrgEx( o:hDC, nLastRow + 2, 1 )
ELSE
SetBrushOrgEx( o:hDC, 2, 2 )
ENDIF
RETURN hBrush
ENDIF
RETURN o:SetFldColors( o, nOption )
// -------- Folder - Background ---------------
FUNCTION F_BACKGRD( nStyle, oFld, hDC, nMove, nColor1, nColor2, lDirect, cBrush, cImage )
LOCAL n, oDlg, oBrush2, oBrush3, oImage2, hDC1
LOCAL aColors := { { nMOVE, nCOLOR1, nCOLOR2 }, ;
{ nMOVE, nCOLOR2, nCOLOR1 } }
LOCAL aRect := GetClientRect( oFld:hWnd )
LOCAL hBmp, hBmpOld
FOR n := 1 TO Len( oFld:aDialogs )
oDlg := oFld:aDialogs[ n ]
hDC1 = CreateCompatibleDC( oDlg:GetDC() )
hBmp = CreateCompatibleBitMap( oDlg:hDC, oDlg:nWidth, oDlg:nHeight )
hBmpOld = SelectObject( hDC1, hBmp )
DEFINE BRUSH oBrush2 FILENAME "..\bitmaps\" + cBrush
FillRect( hDC1, aRect, oBrush2:hBrush )
DeleteObject( oDlg:oBrush:hBrush )
oDlg:oBrush:hBitmap = hBmp
oDlg:oBrush:hBrush = CreatePatternBrush( hBmp )
SelectObject( hDC1, hBmpOld )
oDlg:ReleaseDC()
NEXT
RETURN( NIL )
// fin / end
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 65 guests