Horiz. Gradient-Paint for Buttonbar (on Right-Pos.) ?

Horiz. Gradient-Paint for Buttonbar (on Right-Pos.) ?

Postby ukoenig » Mon Apr 20, 2009 3:13 pm

Hello,

Is it possible, to paint a Buttonbar on Right-Hand-Side with Horizontal-Direction
to get the same results like a Bar on Top-Position ?
( Changes in Bar.prg => Method Paint )
Normally each button is painted with a Gradient ( Vertical ).

The normal Gradient-define for the Buttonbar
-----------------------------------------------------
oBar:bClrGrad := { | lInvert | If( ! lInvert, ;
{ { 0.90,11892819,16777215 },{ 0.90,16777215,11892819 } },;
{ { 0.50,128,16777215 }, { 0.50,16777215,128 } } ) }

A gradient is always painted Vertical ( Top to Bottom )

Lines in class Bar.prg ( GradientFill with fixed value .F. )
Code: Select all  Expand view

METHOD Paint() CLASS TBar
...
...
 ::bClrGrad = { | lInvert | If( ! lInvert,;
   { { 0.25, nRGB( 219, 230, 244 ), nRGB( 207, 221, 239 ) },;
     { 0.75, nRGB( 201, 217, 237 ), nRGB( 231, 242, 255 ) } },;
   { { 0.25, nRGB( 255, 253, 222 ), nRGB( 255, 231, 151 ) }, ;
     { 0.75, nRGB( 255, 215,  84 ), nRGB( 255, 233, 162 ) } } ) }
...
...
 if ::l2007
      GradientFill( ::hDC, 0, 0, ::nHeight, ::nWidth, Eval( ::bClrGrad, .f. ) )
...
...
 


The normal Gradient-Painting includes : .T. or .F. for Horizontal or Vertical
Gradient( hDC, { 0, 0, aRect[3], aRect[4] }, COLOR1, COLOR2, .T. )
In Buttonbars, the direction-parameter is set to .F.

My solution for the moment :
A gradient on the right-hand-side and Alpha-blended-BMP's on Top.

Image

Normal Bar-Display on right position :
Image

The same Bar on Top :
Image

Bring it on Top, the Bottom-Line is different in spaces without Button use.

---------------------------------------------------------------------------------------
function GradientFill( hDC, nTop, nLeft, nBottom, nRight, aGradInfo, lVert )
local nClr := 1, nClrs := Len( aGradInfo )
local nSize, nSlice

Changing this line in Bar.prg :

DEFAULT lVert := .F.
----------------------------------------------------------------------------------------
Shows this result like expected, but the no Button-Area shows the same Gradient-Color like
a captured Button ( must be the same color, like Buttons with no capture ).
I don't know, if it is possible to make the needed changes in Bar.prg
Image

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

Return to FiveWin for Harbour/xHarbour

Who is online

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