FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index All products support Utilizzare gli splitter per il resize automatico
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Utilizzare gli splitter per il resize automatico
Posted: Fri Apr 27, 2007 10:43 AM
trovata :

void GradientFill( HDC hDC, RECT* rct, COLORREF crStart, COLORREF crEnd, int bVertical ) 
    { 
       int nSegments = 100; 
       COLORREF cr; 

       int nR      = GetRValue(crStart); 
       int nG      = GetGValue(crStart); 
       int nB      = GetBValue(crStart); 
       int neB     = GetBValue(crEnd); 
       int neG     = GetGValue(crEnd); 
       int neR     = GetRValue(crEnd); 
       int nDiffR  = (neR - nR); 
       int nDiffG  = (neG - nG); 
       int nDiffB  = (neB - nB); 
       int ndR ; 
       int ndG ; 
       int ndB ; 
       int nCX ; 
       int nCY ; 
       int nTop    = rct->top; 
       int nBottom = rct->bottom; 
       int nLeft   = rct->left; 
       int nRight  = rct->right; 
       HBRUSH hBrush; 
       RECT rc; 

       int i; 

       if( !bVertical ) 
       { 
          if( nSegments > ( rct->right - rct->left ) ) 
          { 
            nSegments = ( rct->right - rct->left ); 
          } 
       } 
       else 
       { 
          if( nSegments > ( rct->bottom - rct->top ) ) 
          { 
            nSegments = ( rct->bottom - rct->top ); 
          } 
       } 

       ndR = 256 * (nDiffR) / (max(nSegments,1)); 
       ndG = 256 * (nDiffG) / (max(nSegments,1)); 
       ndB = 256 * (nDiffB) / (max(nSegments,1)); 
       nCX = (rct->right-rct->left) / max(nSegments,1); 
       nCY = (rct->bottom-rct->top) / max(nSegments,1); 



       nR *= 256; 
       nG *= 256; 
       nB *= 256; 

       for (i = 0; i < nSegments; i++, nR += ndR, nG += ndG, nB += ndB) 
       { 

               if(i == (nSegments - 1)) 
               { 
                  nRight  = rct->right; 
                  nBottom = rct->bottom; 
               } 
               else 
               { 
                  nBottom = nTop + nCY; 
                  nRight = nLeft + nCX; 
               } 

               cr = RGB(nR / 256, nG / 256, nB / 256); 

               { 
                  hBrush = CreateSolidBrush( cr ); 
                  if( bVertical ) 
                  { 
                     rc.top    = nTop; 
                     rc.left   = rct->left; 
                     rc.bottom = nBottom + 1; 
                     rc.right  = rct->right; 
                  } 
                  else 
                  { 
                     rc.top    = rct->top; 
                     rc.left   = nLeft; 
                     rc.bottom = rct->bottom; 
                     rc.right  = nRight+1; 
                  } 
                  FillRect(hDC, &rc, hBrush ); 
                  DeleteObject( hBrush ); 
               } 

               nLeft = nRight; 
               nTop = nBottom; 
       } 
    } 


   HB_FUNC( DEGRADA ) 
   { 
           RECT rct; 

           rct.top      = hb_parni( 2, 1 ); 
           rct.left      = hb_parni( 2, 2 ); 
           rct.bottom = hb_parni( 2, 3 ); 
           rct.right    = hb_parni( 2, 4 ); 

           GradientFill( ( HDC ) hb_parnl( 1 ) , &rct, hb_parnl( 3 ), hb_parnl( 4 ), hb_parl(5) ); 
   } 


local lVertical := .t. 
Degrada( hDC, { 10, 10, 200, 200},  CLR_WHITE, CLR_BLUE, lVertical )
Best Regards, Saludos



Falconi Silvio
Posts: 858
Joined: Fri Oct 07, 2005 12:00 PM
Utilizzare gli splitter per il resize automatico
Posted: Fri Apr 27, 2007 01:17 PM

>già fatto ma in questo caso assume come colore di background il nero.

>Ovviamente non è così, avrai fatto qualche errore solo che senza un >esempio minimale che lo mostri non posso saperlo.

Ho inserito un self-contained sample che evidenzia il problema della bitmap su www.softwarexp.co.uk/beta/test.zip

Qualche idea ?

Best Regards,



Marco Turco

SOFTWARE XP LLP
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Utilizzare gli splitter per il resize automatico
Posted: Fri Apr 27, 2007 01:28 PM
Marco Turco wrote:Ho inserito un self-contained sample che evidenzia il problema della bitmap su www.softwarexp.co.uk/beta/test.zip

Qualche idea ?


Forse mi sfugge qualcosa ma io lo sfondo del bitmap non lo vedo bianco. Vuoi il mio eseguibile da provare?

EMG
Posts: 858
Joined: Fri Oct 07, 2005 12:00 PM
Utilizzare gli splitter per il resize automatico
Posted: Fri Apr 27, 2007 07:50 PM

Nell'esempio di test nel quale uso lTrasnparent:=.t. lo sfondo della bitmap dovrebbe apparti nero, se invece uso nClrPane lo sfondo della bitmap mi appare bianco.

L'esempio test che hai compilato ti appare con la bitmap trasparente ? Se così, me lo puoi inviare per email a m.turco @ softwarexp.co.uk ?

Grazie

Marco

Best Regards,



Marco Turco

SOFTWARE XP LLP
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Utilizzare gli splitter per il resize automatico
Posted: Fri Apr 27, 2007 09:29 PM

Inviato.

EMG

Continue the discussion