Jose,
Solo un "pequeño" detalle,...
este añadido de la clase si bien funciona perfectamente y dibuja un rombo,
triángulo...
¿como hacer para que su interior sea opaco??
o sea pintar TODA el área interior (como hace FillRect()), enviando un
parámetro más a la clase...
Polygon( aPoints, lOpaco )
Gracias.
Un Saludo,
Xevi.
"Jose F. Gimenez" <jfgimenezAM]"@wanadoo.es> ha escrit al
missatge:52b7f66f$[email=1@svctag-j7w3v3j....]1@svctag-j7w3v3j....[/email]
> Xevi,
>
> pon esto en algún PRG de tu proyecto:
>
> //---------------------------------------------------------- --------------------
>
> CLASS TCanvas FROM XCanvas
>
> METHOD Polygon( aPoints )
>
> ENDCLASS
>
> //---------------------------------------------------------- --------------------
>
> #pragma BEGINDUMP
>
> #include "Windows.h"
> #include "Xailer.h"
>
> HB_FUNC_STATIC( TCANVAS_POLYGON )
> {
> PHB_ITEM Self = hb_stackSelfItem();
> HDC hDC = (HDC) XA_ObjGetNL( Self, "hDC" );
> PHB_ITEM aPoints = hb_param( 1, HB_IT_ARRAY ), aPoint;
> int nPoints, n;
> LPPOINT pt;
>
> if( aPoints && ( ( nPoints = hb_arrayLen( aPoints ) ) != 0 ) )
> {
> pt = hb_xgrab( nPoints * sizeof( POINT ) );
> for( n = 0; n < nPoints; n++ )
> {
> aPoint = hb_arrayGetItemPtr( aPoints, n + 1 );
> pt[ n ].x = hb_arrayGetNL( aPoint, 1 );
> pt[ n ].y = hb_arrayGetNL( aPoint, 2 );
> }
> hb_retnl( Polygon( hDC, pt, nPoints ) );
> hb_xfree( pt );
> }
> else
> hb_retnl( 0 );
> }
>
> #pragma ENDDUMP
>
> //---------------------------------------------------------- --------------------
>
> Con eso, ya lo tienes como un método más de TCanvas, y para usarlo sólo
> tienes que pasarle un array de puntos, donde cada punto es un array de 2
> elementos (x e y). P.ej.:
>
> ::oCanvas:Polygon( { { 100, 0, }, { 200, 100 }, { 100, 200 }, { 0,
> 100 } } )
>
>
> Por otro lado, ya que está, vamos a añadirlo a Xailer

>
>
> Un saludo,
>
> José F. Giménez
>
http://www.xailer.com
>
http://www.xailer.info