FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Gradient on TPanel?
Posts: 445
Joined: Thu Feb 21, 2008 11:58 AM
Gradient on TPanel?
Posted: Mon Aug 31, 2009 05:57 PM

Dear Antonio and friends, Good afternoon!

Exists any way to create a gradient effect into TPanel class? The visual effect 2007?

Peace and lighting!

JĂșlio CĂ©sar M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Gradient on TPanel?
Posted: Mon Aug 31, 2009 06:43 PM
A preliminary Solution :
Create a Gradient-Bmp and use it as a Brush.
If You want to use a vertical-gradient, the Bmp-length must be >= Panel-length,
otherwise the gradient is shown tiled.



DEFINE BRUSH oBrush FILENAME "..\bitmaps\16x16\Gradient1.bmp"

oPanel := TPanel():New( 0, 0, 75, 290, oReBar )
oPanel:SetBrush( oBrush )

Best Regards
Uwe :-)
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.
Posts: 445
Joined: Thu Feb 21, 2008 11:58 AM
Re: Gradient on TPanel?
Posted: Mon Aug 31, 2009 06:52 PM
Great Uwe!

But, without a image file... it's possible too?

Some like this:
Code (fw): Select all Collapse
lLook2007 := .T.
oBar := TBar():New( oWnd, 100, 68, .T., "TOP",, lLook2007 )
oPanel := TPanel():New( 0, oBar:nLeft, 68, oBar:nRight, oBar )
Peace and lighting!

JĂșlio CĂ©sar M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Gradient on TPanel?
Posted: Mon Aug 31, 2009 07:05 PM
Hello JC,

the tPanel-Class includes only in ON PAINT :

FillRect( ::hDC, GetClientRect( ::hWnd ), ::hBrush )

I can test, if it is possible to change this with < Gradientfill > maybe it works.

Best regards
Uwe :-)
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.
Posts: 445
Joined: Thu Feb 21, 2008 11:58 AM
Re: Gradient on TPanel?
Posted: Mon Aug 31, 2009 08:09 PM
Dear Uwe,

I tried but, not work

Code (fw): Select all Collapse
IF ::l2007
   GradientFill( ::hDC, 0, 0, ::nHeight, ::nWidth, Eval( ::bClrGrad, .f. ) )
   return 0
ENDIF
Peace and lighting!

JĂșlio CĂ©sar M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Re: Gradient on TPanel?
Posted: Mon Aug 31, 2009 11:54 PM

tpanel has an error on paint method.
Antonio erased the line where call the function floodfill because when we use different tpanel there is an error on hbrush variable.
If you want the same effect of tpanel you must create a dialog with Nor 4 style and insert at right scrollbar if you want.
Only with this dialog tou can use graduent functiin to
colorize it.
but this is only an mine idea!

Best Regards, Saludos



Falconi Silvio

Continue the discussion