Gradient on TPanel?

Post Reply
User avatar
JC
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil
Contact:

Gradient on TPanel?

Post by JC »

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
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Re: Gradient on TPanel?

Post by ukoenig »

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.

Image

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

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

Best Regards
Uwe :lol:
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.
User avatar
JC
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil
Contact:

Re: Gradient on TPanel?

Post by JC »

Great Uwe!

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

Some like this:

Code: Select all

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
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Re: Gradient on TPanel?

Post by ukoenig »

Hello JC,

the tPanel-Class includes only in ON PAINT :

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

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

Best regards
Uwe :lol:
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.
User avatar
JC
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil
Contact:

Re: Gradient on TPanel?

Post by JC »

Dear Uwe,

I tried but, not work

Code: Select all

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
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: Gradient on TPanel?

Post by Silvio »

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
Post Reply