Gradient-Backgrounds for Dialogs ( problem solved )
Posted: Tue Apr 29, 2008 12:36 pm
Hello,
In the Tools i added a background-gradient-option
for dialogs
Everything : colors, pictures, brushes is working
because they have been defined, before i open the dialog.
To calculate a gradient, the dialog has to be open for the
calculation.
The calculation is ok, but the gradient-brush is outside of the dialog
It seems, it is painted on the main-window.
All other backgrounds are working
I think, the gradient must be defined, before i open the dialog.
Regards
Uwe [/code]
In the Tools i added a background-gradient-option
for dialogs
Everything : colors, pictures, brushes is working
because they have been defined, before i open the dialog.
To calculate a gradient, the dialog has to be open for the
calculation.
The calculation is ok, but the gradient-brush is outside of the dialog
It seems, it is painted on the main-window.
Code: Select all
FUNCTION SHOW_FILE( nPOSITION )
Local oDlg5, oBrush3
IF SD_POS < 8 // Colors
DEFINE BRUSH oBrush3 COLOR SD_COLOR1
ENDIF
IF SD_POS = 8 // Brushes
DEFINE BRUSH oBrush3 STYLE BORLAND
ENDIF
IF SD_POS = 9
DEFINE BRUSH oBrush3 STYLE TILED
ENDIF
IF SD_POS = 10
DEFINE BRUSH oBrush3 STYLE BRICKS
ENDIF
IF SD_POS = 11 // Brush
DEFINE BRUSH oBrush3 FILE cSHOWLOGO
ENDIF
IF SD_POS = 12 // Picture
IF !FILE( "&cSHOWLOGO" )
MsgAlert("Your selected Logo : " + cSHOWLOGO + CRLF + ;
"is not found in the directory : " + c_path + CRLF + ;
"When you select the Button INI-FILE-Setting" + CRLF + ;
"you can choose a different BACKGROUND", "ATTENTION" )
ENDIF
DEFINE IMAGE oImage FILENAME cSHOWLOGO
ENDIF
// SD_POS = 13 // Gradient Horizontal
// SD_POS = 14 // Gradient Vertical
DEFINE DIALOG oDlg5 RESOURCE "TEST4" TITLE "Dialog-Preview" PIXEL BRUSH oBrush3 TRANSPARENT
ACTIVATE DIALOG oDlg5 CENTERED ;
ON INIT DBACK_GRD(oDlg5,SD_COLOR1,SD_COLOR2, SD_POS) // Gradient-Test
RETURN( NIL )
// ---------------------------------------
FUNCTION DBACK_GRD(oDlg5, vCOLOR,bCOLOR,nPOS)
IF nPOS = 13 .or. nPOS = 14
aRect := GETCLIENTRECT( oDlg5:hWnd )
hdc := GetDC( oDlg5 )
nGRADIENT := 0
IF nPOS = 13 // Horizontal
nGRADIENT := Gradient( hDC, { aRect[1], aRect[2], aRect[3], aRect[4] }, ;
vCOLOR, bCOLOR, .F. ) // .T. Horizontal
ENDIF
IF nPOS = 14 // Vertical
nGRADIENT := Gradient( hDC, { aRect[1], aRect[2], aRect[3], aRect[4] }, ;
vCOLOR, bCOLOR, .T. ) // .F. Vertical
ENDIF
oBrush3 := TBrush():New( , nGRADIENT )
ReleaseDC( oDlg5:hWnd, hDC )
ENDIF
I think, the gradient must be defined, before i open the dialog.
Regards
Uwe [/code]