DEFINE DIALOG oDlg10 RESOURCE "SETUP0" FONT oDlgFont;
TITLE "Button-Setup" TRANSPARENT
REDEFINE FOLDER oFld ID 100 OF oDlg10 UPDATE ;
PROMPTS " &Windows and Dialog ", " &Buttonbar " ;
DIALOGS "Page1", "Page2" FONT oFoldFont
FOLDER_1() // Window / Dialog
FOLDER_2() // Buttonbar
// Any existing small BMP
// -----------------------------
REDEFINE BITMAP oBmp ID 500 RESOURCE "WHITE" OF oDlg10 ;
PIXEL ADJUST NOBORDER
oBMP:cTooltip := "Please select a Button"
// Windows- Dialog-Title Height = 30
// ------- CREATE A DIALOG-TITLE ----------------
oBMP:bPainted := { |hDC| ;
DRAW_TITLE( oDlg10, ;
oBMP, ; // BMP
hDC, ; // hDC
.T., ; // Horiz. or Vert.
14853684, ; // 1. Grad-Color
16314573, ; // 2. Grad-Color
0.50, ; // Color-Pos.
30, ; // Text-Pos from left ( 0 = centered )
oTitleFont, ; // Font
128, ; // Font-Color
"Change all Values for Button-Display and Window-Background", ; // Text, ;
1, ; // Box-Pen
128 ) } // Line-Color Blue = 8388608
// Click on Title
// -----------------
oBMP:bLDblClick := { | nRow, nCol, nFlags | ;
MsgInfo( "DblClick on the Title" ) }
ACTIVATE DIALOG oDlg10 CENTERED NOWAIT ;
ON INIT ( oDlg10:Move( 100, 20, oDlg10:nWidth, oDlg10:nHeight, .f. ), ;
SetImages() ) ;
ON PAINT( SETUP_GRAD( hDC, oDlg10 ), ;
GradBrush( oDlg10, { { 0.5, 16445897, 15650662 },;
{ 0.5, 15650662, 16445897 } }, 1 ), ;
SetFoldGrad( oFld ) )
RETURN( NIL )
// -------------- SETUP - GRADIENT --------------------
STATIC FUNCTION SETUP_GRAD( hDC, oDlg )
local aGrad := { { 0.5, 16445897, 15650662 }, ;
{ 0.5, 15650662, 16445897 } }
GradientFill( hDC, 0, 0, oDlg:nHeight, oDlg:nWidth, aGrad, .T. )
RELEASEDC( hDC )
RETURN NIL
// ---------- FOLDER GRADIENT different to DIALOG ----------------------
STATIC FUNCTION SetFoldGrad( oFld )
local n, oDlg
for n = 1 to Len( oFld:aDialogs )
oDlg = oFld:aDialogs[ n ]
oDlg:bPainted = { | hDC | GradientFill( hDC, 0, 0, oDlg:nHeight, oDlg:nWidth, { { 0.50, 12609872, 16045947 } }, .T. ) }
next
RETURN NIL
//----------------------------------------------------------------------------//
function SetImages()
local oImageList
DEFINE IMAGELIST oImageList SIZE 16, 16
oImageList:AddMasked( TBitmap():Define( "image1",, oDlg1 ), nRGB( 192, 192, 192 ) )
oImageList:AddMasked( TBitmap():Define( "open1",, oDlg1 ), nRGB( 192, 192, 192 ) )
oFld:SetImageList( oImageList )
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 - Title -----------
FUNCTION DRAW_TITLE( oDlg, oBitmap, hDC, lDirect,nVColor, ;
nBColor, nMove, nLeft, oFont, nTColor, cTitle, nPen, nPColor )
LOCAL aGrad := { { nMove, nVColor, nBColor }, { nMove, nBColor, nVColor } }
LOCAL aRect := GETCLIENTRECT( oBitmap:hWnd )
LOCAL oNewBrush, oBtn1
DEFINE BRUSH oNewBrush ;
COLOR GradientFill( hDC, 0, 0, aRect[3], aRect[4], aGrad, lDirect )
hOldFont := SelectObject( hDC, oFont:hFont )
nTXTLG := GettextWidth( hDC, cTitle )
nBMPLONG := oDlg:nWidth()
nBMPHIGHT := oBitmap:Super:nHeight()
nFONTHIGHT := oFont:nInpHeight * -1
IF nLEFT = 0
nLEFT := (nBMPLONG - nTXTLG) / 2
ENDIF
nNEWHIGHT := nFONTHIGHT
nTOP := (nBMPHIGHT - nNEWHIGHT) / 2
SetTextColor( hDC,nTColor)
SetBkMode( oBitmap:hDC, 0 )
TextOut( hDC, nTOP, nLEFT, cTitle )
*oBitmap:ReleaseDC()
RELEASE BRUSH oNewbrush
RETURN NIL