Antonio,
Thank You very much.
It works, but only with Controls supporting brushes like xbrowse.
I added 2 browser to the sample ( used a very simple style )
as well transparent TTitles with Alpha-image..
The new sample detects the control-position
and uses the defined dialog-brush-section as own brush
As soon a control supports brushes, it works.
( maybe sounds a little bit complicated )
Instead of using < Fillrect > a solution would be, to define a brush-area ?
For the moment the complete contol is filled with a defined brush.
![Image](http://www.pflegeplus.com/pictures/combi10.jpg)
Code: Select all | Expand
FUNCTION MAIN()
LOCAL oDlg, oBrw1, oBrw2, oSay1, oSay2, oBrush1, oBrush2, oBrush3
LOCAL aArray := {}, oTitle1, oTitle2
if empty( aArray )
aArray := {{"one","two","three","four"},;
{"one","two","three","four"}}
endif
c_path := cFilePath(GetModuleFileName( GetInstance() ) )
c_path1 := c_path + "IMAGES\"
oFont := TFont():New("Arial",0,-40,.F.,.T.,0,0,0,.T. )
DEFINE BRUSH oBrush1 FILE c_path1 + "Paper.bmp"
DEFINE BRUSH oBrush2 FILE c_path1 + "Blustone.bmp"
DEFINE BRUSH oBrush3 FILE c_path1 + "Marble.bmp"
DEFINE DIALOG oDlg from 0,0 to 400, 500 pixel TITLE "Brush-Test"
@ 10, 30 SAY oSay1 PROMPT "Transparent Say 1" ;
OF oDlg SIZE 190, 30 FONT oFont PIXEL UPDATE
// oSay1:lTransparent := .T.
oSay1:SetColor( 0, )
@ 40, 25 XBROWSE oBrw1 SIZE 180, 50 PIXEL OF oDlg ;
COLUMNS 1, 2, 3, 4 ;
HEADERS "One","Two","Three","Four" ;
COLSIZES 50, 50, 50, 50 ;
ARRAY aArray LINES FASTEDIT CELL
WITH OBJECT oBrw1
:nEditTypes := EDIT_GET
:CreateFromCode()
END
@ 45,165 TITLE oTitle1 size 70, 45 of oDlg SHADOW TOPRIGHT
oTitle1:lTransparent := .T.
@ 5, 30 TITLEIMG OF oTitle1 BITMAP c_path1 + "Logo7.bmp" ;
SIZE 100, 80 REFLEX TRANSPARENT
@ 110, 30 SAY oSay2 PROMPT "Transparent Say 2" ;
OF oDlg SIZE 190, 30 FONT oFont PIXEL UPDATE
// oSay2:lTransparent := .T.
oSay2:SetColor( 0, )
oDlg:bPainted := {|hDC| SET_BR1( oDlg, hDC, 1, "Paper.bmp" ), ;
SET_BR1( oDlg, hDC, 2, "Blustone.bmp" ) }
@ 140, 25 XBROWSE oBrw2 SIZE 180, 50 PIXEL OF oDlg ;
COLUMNS 1, 2, 3, 4 ;
HEADERS "One","Two","Three","Four" ;
COLSIZES 50, 50, 50, 50 ;
ARRAY aArray LINES FASTEDIT CELL
WITH OBJECT oBrw2
:nEditTypes := EDIT_GET
:CreateFromCode()
END
@ 145,165 TITLE oTitle2 size 70, 45 of oDlg SHADOW TOPRIGHT
oTitle2:lTransparent := .T.
@ 5, 30 TITLEIMG OF oTitle2 BITMAP c_path1 + "Logo7.bmp" ;
SIZE 100, 80 REFLEX TRANSPARENT
ACTIVATE DIALOG oDlg CENTERED ;
ON INIT SET_BR2( oDlg, oBrush1, oBrush2 )
oFont:End()
oBrush1:End()
oBrush2:End()
RETURN NIL
//--------- Background ------------------------
FUNCTION SET_BR1( oDlg, hDC, nSection, cBrush )
LOCAL oImage, hBmp
hBmp = ReadBitmap( 0, c_path1 + cBrush )
hBack = CreatePatternBrush( hBmp )
DeleteObject( hBmp )
IF nSection = 1
FillRect( hDC, { 0, 0, 190, oDlg:nWidth }, hBack )
ENDIF
IF nSection = 2
FillRect( hDC, { 190, 0, oDlg:nBottom, oDlg:nWidth }, hBack )
ENDIF
RETURN NIL
// ---------------------
FUNCTION SET_BR2( oDlg, oBrush1, oBrush2 )
LOCAL oBrush, nColor := 0
I := 1
FOR I := 1 TO LEN( oDlg:aControls )
// IF oDlg:aControls[I]:lTransparent = .T.
IF oDlg:aControls[I]:nTop < 150 // Define top Section
// MsgAlert( oDlg:aControls[I]:nTop, "1. Section" )
oBrush := oBrush1
nColor := 255
ELSEIF oDlg:aControls[I]:nTop > 150
// MsgAlert( oDlg:aControls[I]:nTop, "2. Section" )
oBrush := oBrush2
nColor := 8454143 // 16711680
ENDIF
oDlg:aControls[I]:SetBrush( oBrush )
// oDlg:aControls[I]:SetColor ( 0, nColor ) // SetBrush( oBrush )
// ENDIF
NEXT
RETURN NIL
Best Regards
Uwe
![Laughing :lol:](./images/smilies/icon_lol.gif)