brush on PANEL
- Silvio.Falconi
- Posts: 7136
- Joined: Thu Oct 18, 2012 7:17 pm
- Been thanked: 1 time
brush on PANEL
is it possible create a brush gradient on a Panel (Tpanel) ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Re: brush on PANEL
Silvio,
YES
You can switch from COLOR to GRADIENT.
I still need to define the gradient-calculation ( adjustment ) for changing the vertical size of panel 2 and 3
![Image](http://www.pflegeplus.com/IMAGES/Panel1.jpg)
![Image](http://www.pflegeplus.com/IMAGES/Panel2.jpg)
best regards
Uwe![Very Happy :D](./images/smilies/icon_biggrin.gif)
is it possible create a brush gradient on a Panel (Tpanel)
YES
You can switch from COLOR to GRADIENT.
I still need to define the gradient-calculation ( adjustment ) for changing the vertical size of panel 2 and 3
![Image](http://www.pflegeplus.com/IMAGES/Panel1.jpg)
![Image](http://www.pflegeplus.com/IMAGES/Panel2.jpg)
best regards
Uwe
![Very Happy :D](./images/smilies/icon_biggrin.gif)
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
i work with FW.
If you have any questions about special functions, maybe i can help.
- Silvio.Falconi
- Posts: 7136
- Joined: Thu Oct 18, 2012 7:17 pm
- Been thanked: 1 time
Re: brush on PANEL
can you make a sample ?
define brush oBrush...........
define brush oBrush...........
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
- nageswaragunupudi
- Posts: 10721
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 8 times
- Contact:
Re: brush on PANEL
Code: Select all | Expand
aGrad := { .... your gradient array }
DEFINE BRUSH oBrush GRADIENT aGrad
oPanel:SetBrush( oBrush )
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- Silvio.Falconi
- Posts: 7136
- Joined: Thu Oct 18, 2012 7:17 pm
- Been thanked: 1 time
Re: brush on PANEL
thanks
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
- Silvio.Falconi
- Posts: 7136
- Joined: Thu Oct 18, 2012 7:17 pm
- Been thanked: 1 time
Re: brush on PANEL
I tried with
aGrad :={ { 1, CLR_BLUE, CLR_WHITE } }
DEFINE BRUSH oBrush GRADIENT aGrad
oPanel:=TPanel(5,215,155,305,oDlg)
oPanel:SetBrush( oBrush )
I see all black!!!
aGrad :={ { 1, CLR_BLUE, CLR_WHITE } }
DEFINE BRUSH oBrush GRADIENT aGrad
oPanel:=TPanel(5,215,155,305,oDlg)
oPanel:SetBrush( oBrush )
I see all black!!!
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
- nageswaragunupudi
- Posts: 10721
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 8 times
- Contact:
- nageswaragunupudi
- Posts: 10721
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 8 times
- Contact:
Re: brush on PANEL
Please try this
Code: Select all | Expand
aGrad :={ { 1, CLR_BLUE, CLR_WHITE } }
DEFINE BRUSH oBrush GRADIENT aGrad
DEFINE WINDOW oWnd
oPanel:=TPanel(5,215,155,305,oWnd)
oPanel:SetBrush( oBrush )
oBrush:Resize( oPanel )
ACTIVATE WINDOW oWnd CENTERED
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: brush on PANEL
I couldn't detect anything wrong on panel-brushpainting.
The only thing is, I'm still working on splitter-panel-adjustments
![Image](http://www.pflegeplus.com/IMAGES/Panel3.jpg)
regards
Uwe![Very Happy :D](./images/smilies/icon_biggrin.gif)
The only thing is, I'm still working on splitter-panel-adjustments
![Image](http://www.pflegeplus.com/IMAGES/Panel3.jpg)
Code: Select all | Expand
// at startup
// ------------
IF cBrush = "C" // color
oPanel1:SetColor( "W/R" )
oPanel2:SetColor( "W/G" )
oPanel3:SetColor( "W/B" )
ELSE // gradient, brush, image
PANELBRUSH( oPanel1, 1, cBrush )
PANELBRUSH( oPanel2, 2, cBrush )
PANELBRUSH( oPanel3, 3, cBrush )
ENDIF
// ---- on button-action
@ 110, nBtnleft button "Gradient" size 130, 40 pixel ;
ACTION ( cBrush := "G", ;
PANELBRUSH( oPanel1, 1, cBrush, , oPanel1:nHeight ), ;
PANELBRUSH( oPanel2, 2, cBrush, , oPanel2:nHeight ), ;
PANELBRUSH( oPanel3, 3, cBrush, , oPanel3:nHeight ) ) ;
OF oWnd
// ------------
FUNCTION PANELBRUSH( oPanel, nPanel, cBrush, cImage, nHeight )
LOCAL hDC, hBmp, hBmpOld, oBrush
LOCAL aRect := GETCLIENTRECT( oPanel:hWnd )
LOCAL aColors
IF cBrush = "C" .or. cBrush = "G" // colors used for defined color- and gradient-background
IF nPanel = 1
aColors := { { 1, 16777215, 255 } }
ELSEIF nPanel = 2
aColors := { { 1, 16777215, 32768 } }
ELSEIF nPanel = 3
aColors := { { 1, 16777215, 16711680 } }
ENDIF
ENDIF
IF cBrush = "G"
// MsgAlert( nHeight, "Panel-height" )
hDC = CREATECOMPATIBLEDC( oPanel:GetDC() )
hBmp = CREATECOMPATIBLEBITMAP( oPanel:hDC, oPanel:nWidth, nHeight )
hBmpOld = SELECTOBJECT( hDC, hBmp )
GRADIENTFILL( hDC, 0, 0, oPanel:nHeight, oPanel:nWidth, aColors )
oBrush = TBrush():New( ,,,, hBmp )
oPanel:SetBrush( oBrush )
AEVAL( oPanel:aControls, { | oCtl | If( oCtl:lTransparent, oCtl:SetBrush( oPanel:oBrush ), ) } )
RELEASE BRUSH oBrush
SELECTOBJECT( hDC, hBmpOld )
DELETEDC( hDC )
oPanel:ReleaseDC()
ENDIF
IF cBrush = "B"
DEFINE BRUSH oBrush FILE cImage
oPanel:SetBrush( oBrush )
AEVAL( oPanel:aControls, { | oCtl | If( oCtl:lTransparent, oCtl:SetBrush( oPanel:oBrush ), ) } )
RELEASE BRUSH oBrush
ENDIF
IF cBrush = "I"
DEFINE IMAGE oImage FILE cImage
oBrush := TBrush():new( ,,,, ResizeBmp( oImage:hBitmap, aRect[4], aRect[3], .T. ) )
oImage:End()
oPanel:SetBrush( oBrush )
AEVAL( oPanel:aControls, { | oCtl | If( oCtl:lTransparent, oCtl:SetBrush( oPanel:oBrush ), ) } )
RELEASE BRUSH oBrush
ENDIF
RETURN NIL
regards
Uwe
![Very Happy :D](./images/smilies/icon_biggrin.gif)
Last edited by ukoenig on Mon Dec 19, 2016 2:29 pm, edited 6 times in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
i work with FW.
If you have any questions about special functions, maybe i can help.
- nageswaragunupudi
- Posts: 10721
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 8 times
- Contact:
Re: brush on PANEL
Mr Uwe
The issue is with Gradient brushes and probably with resizeble brushes also.
I am looking into it.
For now, my above example works with Gradient brushes.
I shall simplify the process soon
The issue is with Gradient brushes and probably with resizeble brushes also.
I am looking into it.
For now, my above example works with Gradient brushes.
I shall simplify the process soon
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- nageswaragunupudi
- Posts: 10721
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 8 times
- Contact:
Re: brush on PANEL
Please make this modification in tpanel.prg:
In the METHOD Paint(), please locate these lines:
Please modify the code as below:
Now you can try Gradient brushes and resizeable image brushes:
Here is a sample using simple Splitter
In the METHOD Paint(), please locate these lines:
Code: Select all | Expand
else
FillRect( ::hDC, GetClientRect( ::hWnd ), ::oBrush:hBrush )
endif
Please modify the code as below:
Code: Select all | Expand
else
::PaintBack( ::hDC )
//FillRect( ::hDC, GetClientRect( ::hWnd ), ::oBrush:hBrush )
endif
Now you can try Gradient brushes and resizeable image brushes:
Here is a sample using simple Splitter
Code: Select all | Expand
#include "fivewin.ch"
#include "splitter.ch"
function Main()
local oWnd, oPanel1, oPanel2, oBrush1, oBrush2, oSplit
DEFINE BRUSH oBrush1 FILE "c:\fwh\bitmaps\sea.bmp" STRETCH
DEFINE BRUSH oBrush2 FILE "c:\fwh\bitmaps\hires\office.bmp" STRETCH
DEFINE WINDOW oWnd
oPanel1 := TPanel():New( 0,0,200,900, oWnd )
oPanel2 := TPanel():New( 204,0,500,900, oWnd )
oPanel1:SetBrush( oBrush1 )
oPanel2:SetBrush( oBrush2 )
@ 200,0 SPLITTER oSplit ;
HORIZONTAL ;
PREVIOUS CONTROLS oPanel1 ;
HINDS CONTROLS oPanel2 ;
TOP MARGIN 80 ;
BOTTOM MARGIN 80 ;
SIZE 500, 4 PIXEL ;
OF oWnd ;
_3DLOOK
oWnd:nWidth := 500
oWnd:nHeight := 600
ACTIVATE WINDOW oWnd CENTERED ON RESIZE oSplit:AdjClient()
return nil
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- Silvio.Falconi
- Posts: 7136
- Joined: Thu Oct 18, 2012 7:17 pm
- Been thanked: 1 time
Re: brush on PANEL
Please On dialog not run ok
![Image](http://www.iispascalcomiforti.it/wp-content/uploads/2016/12/bbb.jpg)
![Image](http://www.iispascalcomiforti.it/wp-content/uploads/2016/12/bbb.jpg)
Code: Select all | Expand
Function test()
local oDlg,oFont aGrad
Local oPanel
Local nLevel:= 1
Local cFrtipo:= 1
Local nFrcolore:= 1
DEFINE FONT oFont NAME "MS Sans Serif" SIZE 0, 8
DEFINE DIALOG oDlg FROM 100, 100 TO 454,714;
STYLE DS_MODALFRAME + WS_POPUPWINDOW + WS_VISIBLE + WS_DLGFRAME + 4;
TITLE cTitle PIXEL FONT oFont
aGrad := { { 0.5, 10899511, 16443068 }, { 0.5, 16443068, 10899511 } }
DEFINE BRUSH oBrush GRADIENT aGrad
oPanel:=TPanel(5,215,155,305,oDlg)
oPanel:SetBrush( oBrush )
oBrush:Resize( oPanel )
ACTIVATE DIALOG oDlg;
ON INIT (Show_Raccoglitore(oPanel,nLevel,cFrtipo,nFrcolore))
return nil
//-------------------------------------------------------------------------------------------------//
Function Function Show_Raccoglitore(oPanel,nLevel,cFrtipo,nFrcolore)
Local oBmp
local aBmpFaldoni:= { ".\bitmaps\png\imgFolderArancione.png" ,;
".\bitmaps\png\imgFolderBlu.png" ,;
".\bitmaps\png\imgFolderCiano.png" ,;
".\bitmaps\png\imgFolderGiallo.png" ,;
".\bitmaps\png\imgFolderGrigio.png" ,;
".\bitmaps\png\imgFolderMarrone.png" ,;
".\bitmaps\png\imgFolderNero.png" ,;
".\bitmaps\png\imgFolderRosa.png" ,;
".\bitmaps\png\imgFolderRosso.png" ,;
".\bitmaps\png\imgFolderVerde.png" ,;
".\bitmaps\png\imgFolderViola.png" }
@ 2,10 BTNBMP oBmp OF oPanel ;
SIZE (nLarghezzaRaccoglitori),(nAltezzaRaccoglitori) PIXEL TRANSPARENT ;
Prompt str2lines(alltrim(cFrtipo)," ") ;
NOBORDER ;
Filename aBmpFaldoni[nFrcolore] ;
CENTER ACTION NIL
return nil
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
- nageswaragunupudi
- Posts: 10721
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 8 times
- Contact:
Re: brush on PANEL
Mr Silvio
Please modify tpanel.prg as I suggested above.
Now it will work on windows and dialogs also.
Please remove
oBrush:Resize( oPanel ) from your code.
This is not required after we modify tpanel class.
We are including this change in FWH 16.12
Please modify tpanel.prg as I suggested above.
Now it will work on windows and dialogs also.
Please remove
oBrush:Resize( oPanel ) from your code.
This is not required after we modify tpanel class.
We are including this change in FWH 16.12
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- Silvio.Falconi
- Posts: 7136
- Joined: Thu Oct 18, 2012 7:17 pm
- Been thanked: 1 time
Re: brush on PANEL
Sorry ,
I have another Tpanel.prg because I have another paint method
I have another Tpanel.prg because I have another paint method
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
- nageswaragunupudi
- Posts: 10721
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 8 times
- Contact:
Re: brush on PANEL
Silvio.Falconi wrote:Sorry ,
I have another Tpanel.prg because I have another paint method
Is it an older version?
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India