FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Horiz. Gradient-Paint for Buttonbar (on Right-Pos.) ?
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Horiz. Gradient-Paint for Buttonbar (on Right-Pos.) ?
Posted: Mon Apr 20, 2009 03: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 (fw): Select all Collapse
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.



Normal Bar-Display on right position :


The same Bar on Top :


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


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.

Continue the discussion