Gradient on TPanel?

Gradient on TPanel?

Postby JC » Mon Aug 31, 2009 5: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
User avatar
JC
 
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil

Re: Gradient on TPanel?

Postby ukoenig » Mon Aug 31, 2009 6: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.

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

Re: Gradient on TPanel?

Postby JC » Mon Aug 31, 2009 6:52 pm

Great Uwe!

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

Some like this:
Code: Select all  Expand view
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
JC
 
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil

Re: Gradient on TPanel?

Postby ukoenig » Mon Aug 31, 2009 7:05 pm

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

Re: Gradient on TPanel?

Postby JC » Mon Aug 31, 2009 8:09 pm

Dear Uwe,

I tried but, not work

Code: Select all  Expand view

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
JC
 
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil

Re: Gradient on TPanel?

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 85 guests