Utilizzare gli splitter per il resize automatico

Moderator: Enrico Maria Giordano

Postby Silvio » Fri Apr 27, 2007 10:43 am

trovata :

Code: Select all  Expand view

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

Postby Marco Turco » Fri Apr 27, 2007 1: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 ?
User avatar
Marco Turco
 
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London

Postby Enrico Maria Giordano » Fri Apr 27, 2007 1: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
User avatar
Enrico Maria Giordano
 
Posts: 8356
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Marco Turco » Fri Apr 27, 2007 7: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
User avatar
Marco Turco
 
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London

Postby Enrico Maria Giordano » Fri Apr 27, 2007 9:29 pm

Inviato.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8356
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Previous

Return to All products support

Who is online

Users browsing this forum: No registered users and 3 guests