//------------------- RESOURCE - TEST -----------------------------------------
FUNCTION D_RESOUR()
local oBtn1, oBtn2, oBtn3
local oBtn4, oBtn5, oBtn6
local oBtn7, oBtn8, oBtn9
local oBtn10, oBtn11, oBtn12, oBtn13, oSay3, oBMP2
DEFINE CURSOR oCursorHand HAND
DEFINE DIALOG oDlg2 RESOURCE "DIALOG1" FONT oDlgFont ;
TRANSPARENT
// Color
// -------
IF nSTYLE = 1
D_COLOR( oDlg2 )
ENDIF
// Style-Brush ( bricks, Borland ... )
// ---------------------------------------
IF nSTYLE = 3
D_BRUSH1( oDlg2 )
ENDIF
// ImageBrush
// ----------------
IF nSTYLE = 4
DB_IMAGE( oDlg2 )
ENDIF
// ----- Transparent NOBORDER ---------
REDEFINE BTNBMP oBtn1 ID 100 OF oDlg2 ;
NOBORDER ;
FILENAME c_path + "\project\" + D_BUTTON1 ;
ACTION MsgAlert( "Button-Click", "Button 1" ) ;
PROMPT "But.1" ;
FONT oButtFont ;
RIGHT
oBtn1:lTransparent := .T.
oBtn1:cTooltip := "Button1"
oBtn1:SetColor( D_TCOLOR, )
REDEFINE BTNBMP oBtn2 ID 110 OF oDlg2 ;
NOBORDER ;
FILENAME c_path + "\project\" + D_BUTTON2 ;
ACTION MsgAlert( "Button-Click", "Button 2" ) ;
PROMPT "But.2" ;
FONT oButtFont ;
LEFT
oBtn2:lTransparent := .T.
oBtn2:cTooltip := "Button2"
oBtn2:SetColor( D_TCOLOR, )
REDEFINE BTNBMP oBtn3 ID 120 OF oDlg2 ;
NOBORDER ;
FILENAME c_path + "\project\" + D_BUTTON3 ;
ACTION MsgAlert( "Button-Click", "Button 3" ) ;
PROMPT "But.3" ;
FONT oButtFont ;
TOP
oBtn3:lTransparent := .T.
oBtn3:cTooltip := "Button3"
oBtn3:SetColor( D_TCOLOR, )
// ----- Transparent BORDER ---------
REDEFINE BTNBMP oBtn4 ID 130 OF oDlg2 ;
FILENAME c_path + "\project\" + D_BUTTON1 ;
ACTION MsgAlert( "Button-Click", "Button 4" ) ;
PROMPT "But.4" ;
FONT oButtFont ;
BOTTOM
oBtn4:lTransparent := .T.
oBtn4:cTooltip := "Button4"
oBtn4:SetColor( D_TCOLOR, )
REDEFINE BTNBMP oBtn5 ID 140 OF oDlg2 ;
FILENAME c_path + "\project\" + D_BUTTON2 ;
ACTION MsgAlert( "Button-Click", "Button 5" ) ;
PROMPT "Centered" ;
FONT oButtFont ;
CENTER
oBtn5:lTransparent := .T.
oBtn5:cTooltip := "Button5"
oBtn5:SetColor( 7138036, )
oBtn5:SetColor( D_TCOLOR, )
REDEFINE BTNBMP oBtn6 ID 150 OF oDlg2 ;
FILENAME c_path + "\project\" + D_BUTTON3 ;
ACTION MsgAlert( "Button-Click", "Button 6" ) ;
PROMPT " "
oBtn6:lTransparent := .T.
oBtn6:cTooltip := "Button6"
oBtn6:SetColor( D_TCOLOR, )
// ----- Style 2007 Transparent NOBORDER --------
REDEFINE BTNBMP oBtn7 ID 200 OF oDlg2 2007 ;
NOBORDER ;
FILENAME c_path + "\project\" + D_BUTTON1 ;
ACTION MsgAlert( "Button-Click", "Button 1" ) ;
PROMPT "But.1" ;
FONT oButtFont ;
RIGHT
oBtn7:cTooltip := "Button1"
oBtn7:SetColor( D_TCOLOR, )
REDEFINE BTNBMP oBtn8 ID 210 OF oDlg2 2007 ;
NOBORDER ;
FILENAME c_path + "\project\" + D_BUTTON2 ;
ACTION MsgAlert( "Button-Click", "Button 2" ) ;
PROMPT "But.2" ;
FONT oButtFont ;
LEFT
oBtn8:cTooltip := "Button2"
oBtn8:SetColor( D_TCOLOR, )
REDEFINE BTNBMP oBtn9 ID 220 OF oDlg2 2007 ;
NOBORDER ;
FILENAME c_path + "\project\" + D_BUTTON3 ;
ACTION MsgAlert( "Button-Click", "Button 3" ) ;
PROMPT "But.3" ;
FONT oButtFont ;
TOP
oBtn9:cTooltip := "Button3"
oBtn9:SetColor( D_TCOLOR, )
// ----- Style 2007 Transparent BORDER --------
REDEFINE BTNBMP oBtn10 ID 230 OF oDlg2 2007 ;
FILENAME c_path + "\project\" + D_BUTTON1 ;
ACTION MsgAlert( "Button-Click", "Button 4" ) ;
PROMPT "But.4" ;
FONT oButtFont ;
BOTTOM
oBtn10:cTooltip := "Button4"
oBtn10:SetColor( D_TCOLOR, )
REDEFINE BTNBMP oBtn11 ID 240 OF oDlg2 2007 ;
FILENAME c_path + "\project\" + D_BUTTON2 ;
ACTION MsgAlert( "Button-Click", "Button 5" ) ;
PROMPT "Centered" ;
FONT oButtFont ;
CENTER
oBtn11:cTooltip := "Button5"
oBtn11:SetColor( 7138036, )
oBtn11:SetColor( D_TCOLOR, )
REDEFINE BTNBMP oBtn12 ID 250 OF oDlg2 2007 ;
FILENAME c_path + "\project\" + D_BUTTON3 ;
ACTION MsgAlert( "Button-Click", "Button 6" )
oBtn12:cTooltip := "Button6"
// --------------
REDEFINE BTNBMP oBtn13 ID 300 OF oDlg2 2007 ;
FILENAME c_path + "\system\stop.bmp" ;
PROMPT "Close" ;
FONT oButtFont ;
ACTION ( lOPEN[3] := .F., oDlg2:End() )
oBtn13:lTransparent := .T.
oBtn13:cTooltip := "Close"
REDEFINE SAY oSay3 PROMPT "Transparent Text" ID 260 OF oDlg2 FONT oButtFont ;
COLOR D_TCOLOR PIXEL transparent adjust
AEval( oDlg2:aControls, { | o | o:oCursor := oCursorHand } )
// YOU can RESIZE the Buttons from Resource at Runtime !!!!
// D_MOVE = Gradient-Color-Position
// ---------------------------------------------------------------------
ACTIVATE DIALOG oDlg2 CENTERED NOWAIT ;
ON INIT ( oDlg2:Move( 100, 470, oDlg2:nWidth, oDlg2:nHeight, .f. ), ;
oBtn1:SetSize( D_BUTTONH * 2, D_BUTTONV * 2, .T. ), ;
oBtn2:SetSize( D_BUTTONH * 2, D_BUTTONV * 2, .T. ), ;
oBtn3:SetSize( D_BUTTONH * 2, D_BUTTONV * 2, .T. ), ;
oBtn4:SetSize( D_BUTTONH * 2, D_BUTTONV * 2, .T. ), ;
oBtn5:SetSize( D_BUTTONH * 2, D_BUTTONV * 2, .T. ), ;
oBtn6:SetSize( D_BUTTONH * 2, D_BUTTONV * 2, .T. ), ;
oBtn7:SetSize( D_BUTTONH * 2, D_BUTTONV * 2, .T. ), ;
oBtn8:SetSize( D_BUTTONH * 2, D_BUTTONV * 2, .T. ), ;
oBtn9:SetSize( D_BUTTONH * 2, D_BUTTONV * 2, .T. ), ;
oBtn10:SetSize( D_BUTTONH * 2, D_BUTTONV * 2, .T. ), ;
oBtn11:SetSize( D_BUTTONH * 2, D_BUTTONV * 2, .T. ), ;
oBtn12:SetSize( D_BUTTONH * 2, D_BUTTONV * 2, .T. ), oDlg2:Refresh() ) ;
ON PAINT ( IIF( nSTYLE = 2, ;
( D_GRADIENT( hDC, oDlg2, .T. ), ;
GradBrush( oDlg2, { { D_MOVE, D_COLOR1, D_COLOR2 },;
{ D_MOVE, D_COLOR2, D_COLOR1 } }, .T. ) ), NIL ), ;
IIF( nSTYLE = 5, DL_IMAGE( hDC, oDlg2 ), NIL ), ;
D_ALPHA( hDC, D_BUTTON1, 55, 430 ), ;
D_ALPHA( hDC, D_BUTTON2, 190, 430 ), ;
D_ALPHA( hDC, D_BUTTON3, 330, 430 ) )
RETURN NIL
// -------------- DIALOG - GRADIENT --------------------
STATIC FUNCTION D_GRADIENT( hDC, oDlg, lDirect )
local aGrad := { { D_MOVE, D_COLOR1, D_COLOR2 }, ;
{ D_MOVE, D_COLOR2, D_COLOR1 } }
IF lDirect = .T.
GradientFill( hDC, 0, 0, oDlg:nHeight, oDlg:nWidth, aGrad, .T. )
ELSE
GradientFill( hDC, 0, 0, oDlg:nHeight, oDlg:nWidth, aGrad, .F. )
ENDIF
RELEASEDC( hDC )
RETURN NIL
// -------------------------------
FUNCTION GradBrush( oDlg, aColors , nDir)
local hDC, hBmp, hBmpOld , nWidth , nHeight, lDir
DEFAULT lDir := .T.
IF nDir = 1
lDir := .T.
ELSE
lDir := .F.
ENDIF
if Empty( oDlg:oBrush:hBitmap )
nHeight := if(lDir,oDlg:nHeight,1)
nWidth := if(lDir,1,oDlg:nWidth)
hDC = CreateCompatibleDC( oDlg:GetDC() )
hBmp = CreateCompatibleBitMap( oDlg:hDC, nWidth, nHeight )
hBmpOld = SelectObject( hDC, hBmp )
GradientFill( hDC, 0, 0, nHeight, nWidth, aColors,lDir )
DeleteObject( oDlg:oBrush:hBrush )
oDlg:oBrush:hBitmap = hBmp
oDlg:oBrush:hBrush = CreatePatternBrush( hBmp )
SelectObject( hDC, hBmpOld )
oDlg:ReleaseDC()
endif
RETURN NIL
// ------------- DIALOG - COLOR ----------------------------------
STATIC FUNCTION D_COLOR( oDlg )
local oCBrush
DEFINE BRUSH oCBrush COLOR D_COLOR1
SET BRUSH OF oDlg TO oCBrush
RELEASE BRUSH oCBrush
RETURN NIL
//----------------- DIALOG - STYLE ----------------
FUNCTION D_BRUSH1( oDlg )
LOCAL oBrush
DEFINE BRUSH oBrush STYLE "BORLAND"
SET BRUSH OF oDlg TO oBrush
RELEASE BRUSH oBrush
RETURN NIL
//------------- IMAGE - BRUSH --------------------
FUNCTION DB_IMAGE( oDlg )
LOCAL oImage
DEFINE BRUSH oImage FILE c_path + "\project\" + D_BRUSH
SET BRUSH OF oDlg TO oImage
RELEASE BRUSH oImage
RETURN NIL
//------------- IMAGE - Background --------------------
STATIC FUNCTION DL_IMAGE( hDC, oDlg )
LOCAL oImage1
LOCAL nWidth := oDlg:nWidth()
LOCAL nHeight := oDlg:nHeight()
DEFINE IMAGE oImage1 FILE c_path + "\project\" + D_LOGO
PalBmpDraw( hDC, 0, 0, oImage1:hBitmap, , nWIDTH, nHEIGHT, , .T. )
oDlg:ReleaseDC()
RETURN NIL
// --------------------------------------------------------------
// Using different BMP's for Focus, pressed, Caption ...
// --------------------------------------------------------------
REDEFINE BTNBMP oBtn ID 300 OF oDlg ;
PROMPT "Help" ;
FONT oBarFont ;
TOP ;
NOBORDER ;
FILENAME c_path + "\system\Info_A.bmp", ;
c_path + "\system\Info_P.bmp", ;
c_path + "\system\Info_D.bmp", ;
c_path + "\system\Info_M.bmp" ;
ACTION ( D_START(), ;
IIF( FILE("ButtonHelp.exe"), Winexec("ButtonHelp.exe" ), MsgAlert("Helpfile : ButtonHep.exe " ;
+ CRLF + "not found !", "ATTENTION") ) )
oBtn:lTransparent := .T.
oBtn:cTooltip := "2. Resource Preview"
oBtn:lBorder := .F.