Ciao,
Utilizzo GradBrush() per colorare lo sfondo delle fineste di dialogo e mi sono accorto che se passo da dialog 1 a dialog 2 il colore è ok. Mentre quando ritorno da dialog 2 a dialog 1 ed eseguo un refresh … dialog 1 prende il colore del 2 dialogbox .
Ho risolto facendo eseguire nuovamente GradBrush() dopo la chiusura del 2 dialog
@ 3, 2 BUTTON "dialog 2" OF oDlg ACTION (DIALOG2(),GradBrush( oDlg,nRGB( 255, 255, 255 ), rgb(255,246,143 )))
… ci sono altre idee ??
Gazie e Saluti
Stefano
un pezzo di codice per prova:
// Color Dialog test
#include "FiveWin.ch"
static oDlg,oDlg2
//----------------------------------------------------------------------------//
function Main()
DEFINE DIALOG oDlg TITLE "Dialog 1" FROM 0, 0 TO 20, 40 TRANSPARENT
@ 3, 2 BUTTON "dialog 2" OF oDlg ACTION DIALOG2()
* Per ottenere la pittura corretta
* @ 3, 2 BUTTON "dialog 2" OF oDlg ACTION (DIALOG2(),GradBrush( oDlg,nRGB( 255, 255, 255 ),rgb(255,246,143 )))
ACTIVATE DIALOG oDlg CENTERED ON INIT GradBrush( oDlg,nRGB( 255, 255, 255 ),rgb(255,246,143 ))
return nil
function DIALOG2()
DEFINE DIALOG oDlg2 TITLE "Dialog 2" FROM 0, 0 TO 10, 20 TRANSPARENT
@ 3, 2 BUTTON "dialog 1" OF oDlg2 ACTION (oDlg2:END(),oDlg:refresh())
ACTIVATE DIALOG oDlg2 CENTERED ON INIT GradBrush( oDlg2,nRGB( 255, 25, 25 ),nRGB(255, 69, 0))
return nil
STATIC FUNCTION GradBrush( oDlgkk,color1,color2)
local hDC, hBmp, hBmpOld,obrush
hDC = CreateCompatibleDC( oDlgkK:GetDC() )
hBmp = CreateCompatibleBitMap( oDlgkK:hDC, oDlgkK:nWidth, oDlgkK:nHeight )
hBmpOld = SelectObject( hDC, hBmp )
Gradient( hDC, {0, 0, oDlgkk:nHeight, oDlgKk:nWidth } ,color1,color2, .t. )
DeleteObject( oDlgkK:oBrush:hBrush )
oDlgkK:oBrush:hBitmap = hBmp
oDlgkK:oBrush:hBrush = CreatePatternBrush( hBmp )
SelectObject( hDC, hBmpOld )
oDlgKk:ReleaseDC()
RETURN (nil)
//-------------------------------------------------------------------//
DLL32 FUNCTION CREATECOMPATIBLEBITMAP( hDC AS LONG,;
nWidth AS LONG,;
nHeight AS LONG) AS LONG;
PASCAL FROM "CreateCompatibleBitmap" LIB "gdi32.dll"