LinearGardientBrush

User avatar
reinaldocrespo
Posts: 918
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL

Post by reinaldocrespo »

Paco / Antonio;

He podido incorporar la función, pero no me hace nada. Tal vez no la uso de manera correcta. Abajo un ejemplo de la forma en que la estoy usando.

DEFINE SBUTTONBAR oBar OF oChildWnd SIZE 40, 40
Degrada( oBar:hDC, { 0, 0, oBar:nHeight, oBar:nWidth }, CLR_WHITE, nClr1, .t. )

El resultado es el mismo que sin el uso de la función Degrada.

Reinaldo.
User avatar
Vagner
Posts: 31
Joined: Wed Oct 26, 2005 12:45 pm
Location: São Paulo-Brasil

Post by Vagner »

Olá
Tente essa :

Code: Select all

// Developed by Vagner Wirts
#include <WinTen.h>
#include <Windows.h>
#include <ClipApi.h>
#include <StdLib.h>


void VTDegrade(HDC hDC, RECT * rOrig, COLORREF cCor1, COLORREF cCor2, int nMode) ;

//---------------------------------------------------------------------------//
#ifndef __HARBOUR__
	CLIPPER VTabDegrad( PARAMS )
#else
	HARBOUR HB_FUN_VTABDEGRADE( PARAMS )
#endif

{
	HWND hWnd       = ( HWND ) _parni( 1 );
	HDC hDC         = ( HDC )  _parni( 2 );
	COLORREF cCor1  =          _parnl( 3 );
	COLORREF cCor2  =          _parnl( 4 );
	BOOL lDialog    =          _parl(  5 );
	int  nMode      =          _parni( 6 ) ;
	RECT rct;

	GetClientRect( hWnd, &rct );

	if(!lDialog) rct.top = (nMode == 1 ? 0 : rct.bottom-22 );
	if(!lDialog && nMode == 1) rct.bottom = 20 ;
//	if(lDialog) rct.bottom -= (nMode != 1 ? 3 : (rct.bottom-rct.top <= 100 ? 3 : 0 ) ) ;
	if(lDialog) rct.bottom -= (rct.bottom-rct.top <= 200 ? 2 : 0 ) ;

	VTDegrade( hDC, &rct, cCor1, cCor2 ,nMode);

}

//---------------------------------------------------------------------------//
void VTDegrade(HDC hDC, RECT * rOrig, COLORREF cCor1, COLORREF cCor2, int nMode)
{
	float nColoR1,nColoG1,nColoB1,nColoR2,nColoG2,nColoB2;
	RECT rct;
	HBRUSH hBrush;

	TRIVERTEX pT[2];
	GRADIENT_RECT pTo;
	HRGN Regi;


	rct.top    = rOrig->top ;
	rct.left   = rOrig->left ;
	rct.bottom = rOrig->bottom ;
	rct.right  = rOrig->right ;

	nColoR1 = GetRValue(cCor1);
	nColoG1 = GetGValue(cCor1);
	nColoB1 = GetBValue(cCor1);

	nColoR2 = GetRValue(cCor2);
	nColoG2 = GetGValue(cCor2);
	nColoB2 = GetBValue(cCor2);

	Regi = CreateRectRgn(rct.left,rct.top,rct.right,rct.bottom);
	SelectObject(hDC,Regi);

	pT[0].x     = rct.left;
	pT[0].y     = rct.top;
	pT[0].Red   = (nColoR1*256);
	pT[0].Green = (nColoG1*256);
	pT[0].Blue  = (nColoB1*256);
	pT[0].Alpha = 0;

	pT[1].x     = rct.right;
	pT[1].y     = rct.bottom;
	pT[1].Red   = (nColoR2*256);
	pT[1].Green = (nColoG2*256);
	pT[1].Blue  = (nColoB2*256);
	pT[1].Alpha = 0;

	pTo.UpperLeft = 0;
	pTo.LowerRight = 1;

	GradientFill( hDC , pT , 2, &pTo, 1, 1 ) ;
	DeleteObject(Regi);


}
Use Assim :
VTabDegrade(hWnd,hDc,nRgb(255,255,255),nRgb(000,000,128),0,1)
Inclua no seu lnk a lib :
\Bcc55\Lib\Psdk\msimg32.lib
Abraços
Vagner Wirts
São Paulo-Brasil
User avatar
reinaldocrespo
Posts: 918
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL

Post by reinaldocrespo »

Vagner;

No sé como usarla.

La compilo con BCC32?

La incluyo en uno de mis .prgs entre #pragma BEGINDUMP y #pragma ENDDUMP?

Intenté ambas y recibo muchos errores.

Mi intención es lograr hacer un "gradient" en dialogos y en buttonbar objects.

Gracias,

Reinaldo.
User avatar
Vagner
Posts: 31
Joined: Wed Oct 26, 2005 12:45 pm
Location: São Paulo-Brasil

Post by Vagner »

Olá,
Crie um .C dele.
Ex :
Reinaldo.C
Com o Borland, compile assim :

set bcdir=C:\Borland\BCC55
set fwhdir=C:\FwH

%bcdir%\bin\bcc32 -M -c -D__HARBOUR__ -I%fwhdir%\include;%hdir%\include Reinaldo.C

Irá criar o Reinaldo.Obj

No seu Lnk, inclua com os outros Obj, e inclua a Lib que eu disse :
\Borland\Bcc55\lib\psdk\msimg32.lib

Para executar, dentro do seu PRG, use assim :
Define Dialog oDlg ....

Activate Dialog oDlg On Paint VTabDegrade(oDlg:hWnd,oDlg:hDc,nRgb(255,255,255),nRgb(000,000,128),0,1)
Abraços
Vagner Wirts
São Paulo-Brasil
User avatar
Vagner
Posts: 31
Joined: Wed Oct 26, 2005 12:45 pm
Location: São Paulo-Brasil

Post by Vagner »

Olá,
Crie um .C dele.
Ex :
Reinaldo.C
Com o Borland, compile assim :

set bcdir=C:\Borland\BCC55
set fwhdir=C:\FwH

%bcdir%\bin\bcc32 -M -c -D__HARBOUR__ -I%fwhdir%\include;%hdir%\include Reinaldo.C

Irá criar o Reinaldo.Obj

No seu Lnk, inclua com os outros Obj, e inclua a Lib que eu disse :
\Borland\Bcc55\lib\psdk\msimg32.lib

Para executar, dentro do seu PRG, use assim :
Define Dialog oDlg ....

Activate Dialog oDlg On Paint VTabDegrade(oDlg:hWnd,oDlg:hDc,nRgb(255,255,255),nRgb(000,000,128),0,1)
Abraços
Vagner Wirts
São Paulo-Brasil
User avatar
reinaldocrespo
Posts: 918
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL

Post by reinaldocrespo »

Vagner;

Buena explicación.

Listo.

Cuando compilo con clipapi.h recibo varios errores como estos:

Error E2238 F:\BORLAND\BCC55\INCLUDE\ClipApi.h 38: Multiple declaration for 'WOR
D'
Error E2344 F:\BORLAND\BCC55\INCLUDE\windef.h 145: Earlier declaration of 'WORD'

Error E2238 F:\BORLAND\BCC55\INCLUDE\ClipApi.h 45: Multiple declaration for 'PWO
RD'
Error E2344 F:\BORLAND\BCC55\INCLUDE\windef.h 154: Earlier declaration of 'PWORD
'
Error E2238 F:\BORLAND\BCC55\INCLUDE\ClipApi.h 46: Multiple declaration for 'LPW
ORD'
Error E2344 F:\BORLAND\BCC55\INCLUDE\windef.h 155: Earlier declaration of 'LPWOR
D'
Error E2184 F:\BORLAND\BCC55\INCLUDE\ClipApi.h 52: Enum syntax error
Error E2040 F:\BORLAND\BCC55\INCLUDE\ClipApi.h 52: Declaration terminated incorr
ectly
Error E2190 F:\BORLAND\BCC55\INCLUDE\ClipApi.h 52: Unexpected }
Error E2190 F:\BORLAND\BCC55\INCLUDE\ClipApi.h 52: Unexpected }
Error E2356 F:\BORLAND\BCC55\INCLUDE\ClipApi.h 384: Type mismatch in redeclarati
on of 'strlen'
Error E2344 F:\BORLAND\BCC55\INCLUDE\_str.h 89: Earlier declaration of 'strlen'
Error E2356 F:\BORLAND\BCC55\INCLUDE\ClipApi.h 385: Type mismatch in redeclarati
on of 'strcpy'
Error E2344 F:\BORLAND\BCC55\INCLUDE\_str.h 86: Earlier declaration of 'strcpy'
Error E2356 F:\BORLAND\BCC55\INCLUDE\ClipApi.h 386: Type mismatch in redeclarati
on of 'strcat'
Error E2344 F:\BORLAND\BCC55\INCLUDE\_str.h 84: Earlier declaration of 'strcat'



Sin clipapi.h recibo varios warnings pero no errores.
Pero ahora recibo estos errores cuando hago el Link con el gradient.obj y msimg32.lib:

MAKE Version 5.2 Copyright (c) 1987, 2000 Borland
f:\borland\bcc55\bin\ilink32.exe -Gn -aa -Tpe -s -I\mp\patients -x @MAKE0000.@@@
Turbo Incremental Link 5.00 Copyright (c) 1997, 2000 Borland
Error: Unresolved external '__parnl' referenced from F:\MP8\SHARED\GRADIENT.OBJ
Error: Unresolved external '__parl' referenced from F:\MP8\SHARED\GRADIENT.OBJ
Error: Unresolved external '__parni' referenced from F:\MP8\SHARED\GRADIENT.OBJ

Agradecido,


Reinaldo.
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Reinaldo,

>
Error: Unresolved external '__parnl' referenced from F:\MP8\SHARED\GRADIENT.OBJ
Error: Unresolved external '__parl' referenced from F:\MP8\SHARED\GRADIENT.OBJ
Error: Unresolved external '__parni' referenced from F:\MP8\SHARED\GRADIENT.OBJ
>

Cámbialas por hb_parnl(), hb_parl() y hb_parni().

FWH las cambia automaticamente usando defines de C, al usar ClipApi.h
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Taiwan
Posts: 218
Joined: Fri Oct 07, 2005 1:55 am
Location: Taipei, Taiwan
Contact:

Post by Taiwan »

Hello Vagner, Antonio

I got this warning below:

Warning W8057 VTDegrade.C 86: Parameter 'nMode' is never used in function VTDegrade

How to fix it?

Regards,

Richard
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Richard,

You can safely ignore that warning.
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply